Joner Ruiz
Joner Ruiz

Reputation: 1

How does min_doc_freq work in More Like This Query

I've some parts of documents with the following structure:

"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Dupieux" } ]

And my More Like This query is the following:

"_source": [ "directors.name" ],
"query": {
  "more_like_this": {
    "fields": [ "directors.name" ],
    "like": "quentin tarantino",
    "min_term_freq": 1,
    "min_doc_freq": 9
  }
}

I usnderstand if i use "min_doc_freq": 7 then, in this sample, the query only should retrieve one document "directors": [ { "name": "Quentin Dupieux" } ] is it corret?

But, the query retrieves only 3 documents:

"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Tarantino" } ]
"directors": [ { "name": "Quentin Dupieux" } ]

I don't understand why.. Can anyone tell me why the query retrieves only 3 "documents"

Thanks!

Upvotes: -1

Views: 91

Answers (1)

Joner Ruiz
Joner Ruiz

Reputation: 1

I found the solution to my mistake, i needed to set the number of shards in 1 for elasticsearch 7.6.2 and for elasticsearch 7.4.2 i set the number of shards and number of replicas in 1 in the index creation. Defaults values

"number_of_shards": 1

"number_of_replicas": 1

Thanks!

Upvotes: 0

Related Questions