# Why elasticsearch gives different scores to identical documents

**URL:** <https://discuss.elastic.co/t/why-elasticsearch-gives-different-scores-to-identical-documents/133753>\
**Category:** Elasticsearch\
**Created:** [May 29, 2018, 8:35pm UTC](https://discuss.elastic.co/t/why-elasticsearch-gives-different-scores-to-identical-documents/133753 "2018-05-29T20:35:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saurav\_Prakash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saurav_prakash/32/31090_2.png) [@Saurav\_Prakash](https://discuss.elastic.co/u/Saurav_Prakash)\
**Post date:** [May 29, 2018, 8:35pm UTC](https://discuss.elastic.co/t/why-elasticsearch-gives-different-scores-to-identical-documents/133753/1 "2018-05-29T20:35:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Saurav\_Prakash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saurav_prakash/32/31090_2.png) [@Saurav\_Prakash](https://discuss.elastic.co/u/Saurav_Prakash)\
**Post date:** [May 29, 2018, 9:47pm UTC](https://discuss.elastic.co/t/why-elasticsearch-gives-different-scores-to-identical-documents/133753/2 "2018-05-29T21:47:31Z")

</div>

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"]  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 26, 2018, 9:47pm UTC](https://discuss.elastic.co/t/why-elasticsearch-gives-different-scores-to-identical-documents/133753/3 "2018-06-26T21:47:34Z")

</div>

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