# Different scores on replicas with the same documents

**URL:** https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341
**Category:** Elasticsearch
**Created:** [August 27, 2013, 7:34am UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341 "2013-08-27T07:34:25Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Patrick\_Peschlow](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Patrick\_Peschlow](https://discuss.elastic.co/u/Patrick_Peschlow)
#### Post date: [August 27, 2013, 7:34am UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341/1 "2013-08-27T07:34:25Z")

</div>

Hi all,

we are running ElasticSearch with one primary shard and three replicas.  
Search queries are randomly distributed to these replicas (i.e., the  
default - we don't have any "preference" set). All replicas have the same  
number of documents.

Now if we execute the same search query four times, in many cases we  
receive four different results where the scores differ (and, because of  
that, the order of hits returned sometimes also changes). It seems that  
each replica computes different document scores. One example of the \_score  
field of the same hit in four search requests: 11.18703, 11.106314,  
11.079036, 10.929455. If we continue to send the same request, the score  
returned always is one of these four.

My question is: Assuming that the documents on the replicas are identical,  
can you think of any circumstances in which this kind of different scoring  
can happen? Or is the only explanation for this that replication somehow  
failed and the document content is not the same on all nodes?

Thanks for any ideas,  
Patrick

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)
#### Post date: [August 27, 2013, 10:40am UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341/2 "2013-08-27T10:40:05Z")

</div>

I just answered something like this  
here: [inconsistent sorting by score due to differences between primary and replicas · Issue #3578 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3578)

I think this should give you some idea why this happens 🙂

simon

On Tuesday, August 27, 2013 9:34:25 AM UTC+2, Patrick Peschlow wrote:

> Hi all,
> 
> we are running Elasticsearch with one primary shard and three replicas.  
> Search queries are randomly distributed to these replicas (i.e., the  
> default - we don't have any "preference" set). All replicas have the same  
> number of documents.
> 
> Now if we execute the same search query four times, in many cases we  
> receive four different results where the scores differ (and, because of  
> that, the order of hits returned sometimes also changes). It seems that  
> each replica computes different document scores. One example of the \_score  
> field of the same hit in four search requests: 11.18703, 11.106314,  
> 11.079036, 10.929455. If we continue to send the same request, the score  
> returned always is one of these four.
> 
> My question is: Assuming that the documents on the replicas are identical,  
> can you think of any circumstances in which this kind of different scoring  
> can happen? Or is the only explanation for this that replication somehow  
> failed and the document content is not the same on all nodes?
> 
> Thanks for any ideas,  
> Patrick

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Randall\_McRee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randall_mcree/32/47177_2.png) [@Randall\_McRee](https://discuss.elastic.co/u/Randall_McRee)
#### Post date: [August 27, 2013, 11:59pm UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341/3 "2013-08-27T23:59:02Z")

</div>

Look at the query explanation to see what differs.

Most likely, google DFS\_QUERY\_THEN\_FETCH.

On Tue, Aug 27, 2013 at 3:40 AM, simonw  
[simon.willnauer@elasticsearch.com](mailto:simon.willnauer@elasticsearch.com)wrote:

> I just answered something like this here:  
> [inconsistent sorting by score due to differences between primary and replicas · Issue #3578 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3578)
> 
> I think this should give you some idea why this happens 🙂
> 
> simon
> 
> On Tuesday, August 27, 2013 9:34:25 AM UTC+2, Patrick Peschlow wrote:
> 
> > Hi all,
> > 
> > we are running Elasticsearch with one primary shard and three replicas.  
> > Search queries are randomly distributed to these replicas (i.e., the  
> > default - we don't have any "preference" set). All replicas have the same  
> > number of documents.
> > 
> > Now if we execute the same search query four times, in many cases we  
> > receive four different results where the scores differ (and, because of  
> > that, the order of hits returned sometimes also changes). It seems that  
> > each replica computes different document scores. One example of the \_score  
> > field of the same hit in four search requests: 11.18703, 11.106314,  
> > 11.079036, 10.929455. If we continue to send the same request, the score  
> > returned always is one of these four.
> > 
> > My question is: Assuming that the documents on the replicas are  
> > identical, can you think of any circumstances in which this kind of  
> > different scoring can happen? Or is the only explanation for this that  
> > replication somehow failed and the document content is not the same on all  
> > nodes?
> > 
> > Thanks for any ideas,  
> > Patrick
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Patrick\_Peschlow](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Patrick\_Peschlow](https://discuss.elastic.co/u/Patrick_Peschlow)
#### Post date: [August 28, 2013, 8:40am UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341/4 "2013-08-28T08:40:55Z")

</div>

Thanks for the pointer, I'm still not sure I understand the implications on  
score calculation in my case. I'll post a reply to the discussion in the  
GitHub issue you cited.

On Tuesday, August 27, 2013 12:40:05 PM UTC+2, simonw wrote:

> I just answered something like this here:  
> [inconsistent sorting by score due to differences between primary and replicas · Issue #3578 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3578)
> 
> I think this should give you some idea why this happens 🙂
> 
> simon
> 
> On Tuesday, August 27, 2013 9:34:25 AM UTC+2, Patrick Peschlow wrote:
> 
> > Hi all,
> > 
> > we are running Elasticsearch with one primary shard and three replicas.  
> > Search queries are randomly distributed to these replicas (i.e., the  
> > default - we don't have any "preference" set). All replicas have the same  
> > number of documents.
> > 
> > Now if we execute the same search query four times, in many cases we  
> > receive four different results where the scores differ (and, because of  
> > that, the order of hits returned sometimes also changes). It seems that  
> > each replica computes different document scores. One example of the \_score  
> > field of the same hit in four search requests: 11.18703, 11.106314,  
> > 11.079036, 10.929455. If we continue to send the same request, the score  
> > returned always is one of these four.
> > 
> > My question is: Assuming that the documents on the replicas are  
> > identical, can you think of any circumstances in which this kind of  
> > different scoring can happen? Or is the only explanation for this that  
> > replication somehow failed and the document content is not the same on all  
> > nodes?
> > 
> > Thanks for any ideas,  
> > Patrick

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Patrick\_Peschlow](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Patrick\_Peschlow](https://discuss.elastic.co/u/Patrick_Peschlow)
#### Post date: [August 28, 2013, 8:43am UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341/5 "2013-08-28T08:43:08Z")

</div>

Thanks RKM for the idea, but I don't think the "search type" you mention  
applies in my case. In my situation, the search is not "distributed" in the  
sense that multiple nodes work together on the same request. It is just  
that the search request is routed to different replicas for load balancing,  
but each search query is handled by a single replica only.

On Wednesday, August 28, 2013 1:59:02 AM UTC+2, RKM wrote:

> Look at the query explanation to see what differs.
> 
> Most likely, google DFS\_QUERY\_THEN\_FETCH.
> 
> On Tue, Aug 27, 2013 at 3:40 AM, simonw \<[simon.w...@elasticsearch.com](mailto:simon.w...@elasticsearch.com)\<javascript:\>
> 
> > wrote:
> 
> > I just answered something like this here:  
> > [inconsistent sorting by score due to differences between primary and replicas · Issue #3578 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3578)
> > 
> > I think this should give you some idea why this happens 🙂
> > 
> > simon
> > 
> > On Tuesday, August 27, 2013 9:34:25 AM UTC+2, Patrick Peschlow wrote:
> > 
> > > Hi all,
> > > 
> > > we are running Elasticsearch with one primary shard and three replicas.  
> > > Search queries are randomly distributed to these replicas (i.e., the  
> > > default - we don't have any "preference" set). All replicas have the same  
> > > number of documents.
> > > 
> > > Now if we execute the same search query four times, in many cases we  
> > > receive four different results where the scores differ (and, because of  
> > > that, the order of hits returned sometimes also changes). It seems that  
> > > each replica computes different document scores. One example of the \_score  
> > > field of the same hit in four search requests: 11.18703, 11.106314,  
> > > 11.079036, 10.929455. If we continue to send the same request, the  
> > > score returned always is one of these four.
> > > 
> > > My question is: Assuming that the documents on the replicas are  
> > > identical, can you think of any circumstances in which this kind of  
> > > different scoring can happen? Or is the only explanation for this that  
> > > replication somehow failed and the document content is not the same on all  
> > > nodes?
> > > 
> > > Thanks for any ideas,  
> > > Patrick
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Randall\_McRee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randall_mcree/32/47177_2.png) [@Randall\_McRee](https://discuss.elastic.co/u/Randall_McRee)
#### Post date: [August 28, 2013, 5:19pm UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341/6 "2013-08-28T17:19:38Z")

</div>

That is why I mentioned that you should look into the explanation. It will  
tell you what the statistic is that lucene used to calculate that score.  
Often it will be term frequency, for example. Unless YOU EXPRESSLY STATE  
OTHERWISE VIA THE QUERY TYPE you get a per-shard term frequency which is  
different from the actual term frequency which is only correct when  
calculated across all shards.

So tell us what you figure out.

On Wed, Aug 28, 2013 at 1:43 AM, Patrick Peschlow \<  
[patrick.peschlow@codecentric.de](mailto:patrick.peschlow@codecentric.de)\> wrote:

> Thanks RKM for the idea, but I don't think the "search type" you mention  
> applies in my case. In my situation, the search is not "distributed" in the  
> sense that multiple nodes work together on the same request. It is just  
> that the search request is routed to different replicas for load balancing,  
> but each search query is handled by a single replica only.
> 
> On Wednesday, August 28, 2013 1:59:02 AM UTC+2, RKM wrote:
> 
> > Look at the query explanation to see what differs.
> > 
> > Most likely, google DFS\_QUERY\_THEN\_FETCH.
> > 
> > On Tue, Aug 27, 2013 at 3:40 AM, simonw \<simon.w...@\*\*[elasticsearch.com](http://elasticsearch.com)\>wrote:
> > 
> > > I just answered something like this here: [https://github.com/](https://github.com/)\*\*  
> > > elasticsearch/elasticsearch/\*\*issues/3578[https://github.com/elasticsearch/elasticsearch/issues/3578](https://github.com/elasticsearch/elasticsearch/issues/3578)
> > > 
> > > I think this should give you some idea why this happens 🙂
> > > 
> > > simon
> > > 
> > > On Tuesday, August 27, 2013 9:34:25 AM UTC+2, Patrick Peschlow wrote:
> > > 
> > > > Hi all,
> > > > 
> > > > we are running Elasticsearch with one primary shard and three replicas.  
> > > > Search queries are randomly distributed to these replicas (i.e., the  
> > > > default - we don't have any "preference" set). All replicas have the same  
> > > > number of documents.
> > > > 
> > > > Now if we execute the same search query four times, in many cases we  
> > > > receive four different results where the scores differ (and, because of  
> > > > that, the order of hits returned sometimes also changes). It seems that  
> > > > each replica computes different document scores. One example of the \_score  
> > > > field of the same hit in four search requests: 11.18703, 11.106314,  
> > > > 11.079036, 10.929455. If we continue to send the same request, the  
> > > > score returned always is one of these four.
> > > > 
> > > > My question is: Assuming that the documents on the replicas are  
> > > > identical, can you think of any circumstances in which this kind of  
> > > > different scoring can happen? Or is the only explanation for this that  
> > > > replication somehow failed and the document content is not the same on all  
> > > > nodes?
> > > > 
> > > > Thanks for any ideas,  
> > > > Patrick
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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: [July 6, 2017, 2:19am UTC](https://discuss.elastic.co/t/different-scores-on-replicas-with-the-same-documents/13341/7 "2017-07-06T02:19:13Z")

</div>


