I am confused about what 'min_score' actually does. In the documentation, it states that:
Exclude documents which have a _score less than the minimum specified in min_score
However, in my example, I can not understand how it runs. Here is my query:
GET /example_index/_search
{
"size": 2,
"min_score": 0.5,
"_source": false,
"query":{
"function_score":{
"random_score":{
"field": "_id"
}
}
},
"sort": {"_score": "asc" }
}
Here is the result for the query:
{
"took" : 8,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : null,
"hits" : [
{
"_index" : "example_index",
"_type" : "_doc",
"_id" : "6916564004",
"_score" : 0.50003004,
"sort" : [
0.50003004
]
},
{
"_index" : "example_index",
"_type" : "_doc",
"_id" : "6917883371",
"_score" : 0.5000461,
"sort" : [
0.5000461
]
}
]
}
}
The size of the index is 10000. Based on the query result, the minimum score is 0.50003004, and note that the total value is 10000. So, all of the documents' scores should be greater than 0.5.
However, when I set min_score as 0.6, the minimum score becomes 0.60000676 and the total value is 10000. When I set min_score to 0.9, then the total value decreases.
I do not understand the logic behind min_score. Because I expect that the min_score would be applied after the random_score calculation. However, It does not seem to be the case.
Aucun commentaire:
Enregistrer un commentaire