# Differnt shards giving different results

**URL:** <https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285>\
**Category:** Elasticsearch\
**Created:** [July 1, 2019, 10:23am UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285 "2019-07-01T10:23:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sangam0707](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sangam0707](https://discuss.elastic.co/u/sangam0707)\
**Post date:** [July 1, 2019, 10:23am UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/1 "2019-07-01T10:23:49Z")

</div>

Hi,  
I am using Elasticsearch version 7.1.1.  
My index and cluster settings are as follows.  
**Index Settings:**  
number\_of\_shards: 1  
number\_of\_replicas: 2  
**Cluster structure:**  
Master nodes: 3  
Data nodes:3  
Coordinating node:2

For same query, i am getting getting different results.One shards gives a match and other 2 shards give no match.

**My Observations:**  
Out of 3 shards only 1 shard gives the result for query.Other 2 shards give no match however that document is present on each shard.

Number of documents and size is same for each shard.

```
/_cat/shards
    index shard prirep state docs store ip node
    index-0 0 p STARTED 541384 1.8gb 172.29.236.74 es-data-01
    index-0 0 r STARTED 541384 1.8gb 172.29.236.75 es-data-02
    index-0 0 r STARTED 541384 1.8gb 172.29.236.56 es-data-03

```

Can someone please explain this behaviour or is it a known bug?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [July 1, 2019, 10:27am UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/2 "2019-07-01T10:27:39Z")

</div>

Does the inconsistency persist even after stopping all indexing and running `POST /index-0/_refresh`?

---

<div class="post-metadata">

**Author:** ![sangam0707](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sangam0707](https://discuss.elastic.co/u/sangam0707)\
**Post date:** [July 1, 2019, 10:30am UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/3 "2019-07-01T10:30:57Z")

</div>

Thanks for your quick response.  
Yes ,Indexing was stopped.I refreshed index manually.I observed the same behaviour.  
Then i restarted whole cluster but issue still persists.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [July 1, 2019, 10:31am UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/4 "2019-07-01T10:31:49Z")

</div>

What is the search you're doing?

---

<div class="post-metadata">

**Author:** ![sangam0707](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sangam0707](https://discuss.elastic.co/u/sangam0707)\
**Post date:** [July 1, 2019, 10:42am UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/5 "2019-07-01T10:42:06Z")

</div>

Its a multi clause query which consists of following clauses.  
1 nested clause.  
1 termset query.  
4 match queries.

Or you want exact query?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [July 1, 2019, 10:49am UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/6 "2019-07-01T10:49:18Z")

</div>

Yes, the exact query would help.

Do you get different results when searching for a specific document: either an `ids` query or a terms query matching `_id`, preferably both? What about if you try and `GET` that document?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [July 1, 2019, 1:25pm UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/7 "2019-07-01T13:25:45Z")

</div>

This very closely-related question seems to be due to inconsistent synonyms on the nodes, or synonyms that changed over time:

> [@Different primary and replica shard size](https://discuss.elastic.co/t/different-primary-and-replica-shard-size/187331/7):
>
> A good thought. Yes, inconsistent synonyms files can indeed result in inconsistent search results. Elasticsearch will use the current synonym file for searches and for indexing new documents but will not re-index any old documents, and this can leave your index in a very strange state. I think reindexing would be wise.

Does that apply in your case too?

---

<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 29, 2019, 1:25pm UTC](https://discuss.elastic.co/t/differnt-shards-giving-different-results/188285/8 "2019-07-29T13:25:49Z")

</div>

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