# Different results from two clusters on different data center

**URL:** https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697
**Category:** Elasticsearch
**Created:** [October 21, 2015, 4:29pm UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697 "2015-10-21T16:29:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Youxu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/youxu/32/117375_2.png) [@Youxu](https://discuss.elastic.co/u/Youxu)
#### Post date: [October 21, 2015, 4:29pm UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/1 "2015-10-21T16:29:34Z")

</div>

We deployed our ES cluster on two Azure data centers, and the two cluster contains exactly same index schema and documents.

The issue we found is, when querying same terms, the results from these two cluster are slightly different, event we set the primary shard to 1.

Is this expected ES behavior? What should we do to force the two cluster return exactly same results?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [October 21, 2015, 5:04pm UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/2 "2015-10-21T17:04:37Z")

</div>

How is it different?

Any sample?

---

<div class="post-metadata">

### Author: ![Youxu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/youxu/32/117375_2.png) [@Youxu](https://discuss.elastic.co/u/Youxu)
#### Post date: [October 21, 2015, 5:59pm UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/3 "2015-10-21T17:59:48Z")

</div>

For a certain query, the top 2 documents from two clusters are:

```
    "total": 26,
    "max_score": 4.186072,
    "hits": [
        {
            "_score": 4.186072,
            "_type": "ja-jp",                
            "_source": {
                "DocumentId": "1041_1",
                "Language": "Japanese (Japan)"
            }
        },
        {
            "_score": 3.3488574,
            "_type": "ja-jp",                   
            "_source": {
                "DocumentId": "1041_2",
                "Language": "Japanese (Japan)",
            }
        }

```

And

```
    "total": 26,
    "max_score": 4.186072,
    "hits": [
        {
            "_score": 4.186072,
            "_type": "ja-jp",
            "_source": {
                "DocumentId": "1041_1",
                "Language": "Japanese (Japan)"
            }
        },
        {
            "_score": 3.3488574,
            "_type": "de-de",
            "_source": {
                "DocumentId": "1031_1",
                "Language": "German (Germany)",
            }
        } 

```

You can see that the total document count, max score, and the score of top 2 docs are all same. But the 2nd document from two clusters are different, although the score are same.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [October 21, 2015, 6:50pm UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/4 "2015-10-21T18:50:48Z")

</div>

Does 1031\_1 also appears in the results with same score for the first cluster ?

---

<div class="post-metadata">

### Author: ![Youxu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/youxu/32/117375_2.png) [@Youxu](https://discuss.elastic.co/u/Youxu)
#### Post date: [October 22, 2015, 12:55am UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/5 "2015-10-22T00:55:28Z")

</div>

Thanks reply.  
Yes, you are right, the 1031\_1 also appears in first cluster results (at 6th position), the score is also 3.3488574. I think that is why we got different result from two cluster.

Any solution to force two cluster always return exactly same docs with same order?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [October 22, 2015, 4:51am UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/6 "2015-10-22T04:51:50Z")

</div>

You can use sort to sort by \_score then by another field (like a date).  
If you really want to have the exact same results, you need to have exactly the same data files everywhere (also primary and replicas).

Cluster1:

Set replicas to 0  
Snapshot the index  
Set replicas to 1

Cluster2:

Delete old index  
Restore index from the repository you created earlier  
Set replicas to 1

But as soon as you will index new data, your system could diverge again.

It's not really what I'd do.

Sorting by \_score only means that you don't care of anything else then the score. So even if results are different on both cluster, they are correct.

---

<div class="post-metadata">

### Author: ![Youxu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/youxu/32/117375_2.png) [@Youxu](https://discuss.elastic.co/u/Youxu)
#### Post date: [October 22, 2015, 10:12am UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/7 "2015-10-22T10:12:19Z")

</div>

Sort by \_score then sort by another field makes sense. Thanks David!

---

<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 5, 2017, 11:43pm UTC](https://discuss.elastic.co/t/different-results-from-two-clusters-on-different-data-center/32697/8 "2017-07-05T23:43:20Z")

</div>


