Why elasticsearch gives different scores to identical documents

Hello.
I was using an elastic search (rspec, rails) test with 5 documents. Each one has same name field as name "funny". I then ran the following query:

GET /test_videos/_search
{
"explain": true,
"query": {
"bool": {
"must": {
"multi_match": {
"query": "funny",
"fields": ["name", "tags"]
}
}
}
}
}
which gave me 5 hits.

But I couldn't understand the order. Each documents are identical with respect to their name which is funny and all other fields. The only difference is the time of creation (which I am setting as 1 day, 1 month, 1 year, 2 year etc ).

But in the explain api elastic-search suggests that for first three hits, the score is "_score": 0.2876821 while for the last two the score is: "_score": 0.18232156.

Why would that happen if all documents are identical. How can I force elasticsearch to give the same score to exact documents?

Thanks.

Found out that its mainly due to search_type which is using tf/idf. Used dfs_query_then_fetch. and it works now.

GET /test_claim_videos/_search?search_type=dfs_query_then_fetch
{
"explain": true,
"query": {
"bool": {
"must": {
"multi_match": {
"query": "funny",
"fields": ["title", "asset_name", "description", "tags.name", "asset_group_name.humanized", "credit"]
}
}
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.