# Is it possible searching returned different results when refreshing

**URL:** <https://discuss.elastic.co/t/is-it-possible-searching-returned-different-results-when-refreshing/58042>\
**Category:** Elasticsearch\
**Created:** [August 15, 2016, 4:52pm UTC](https://discuss.elastic.co/t/is-it-possible-searching-returned-different-results-when-refreshing/58042 "2016-08-15T16:52:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deng](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@Deng](https://discuss.elastic.co/u/Deng)\
**Post date:** [August 15, 2016, 4:52pm UTC](https://discuss.elastic.co/t/is-it-possible-searching-returned-different-results-when-refreshing/58042/1 "2016-08-15T16:52:43Z")

</div>

Suppose there are there es data node : nodeA, nodeB, nodeC, and a index tweet with 1 primary shard and 2 replicas and no automatic refresh setting, it will result the primary shard in nodeA, the replica1 in nodeB, the replica1 in nodeC, so I can connect to any node for querying。  
My question is when I called refresh for tweet after indexed 10 docs , while there are three thread connected to the three different node for same query , like  
thread1 -\> nodeA  
thread2 -\> nodeB  
thread3 -\> nodeC  
is it possible nodeA refreshed first and the query returned 10 records, meanwhile nodeB has not yet refreshed and the query returned 0 records？  
If it's possible, is there a option for refresh to block the search request until all shard and replicas refresed?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [August 15, 2016, 5:11pm UTC](https://discuss.elastic.co/t/is-it-possible-searching-returned-different-results-when-refreshing/58042/2 "2016-08-15T17:11:08Z")

</div>

> [@Deng](#):
>
> is it possible nodeA refreshed first and the query returned 10 records, meanwhile nodeB has not yet refreshed and the query returned 0 records？

Yes.

> [@Deng](#):
>
> If it's possible, is there a option for refresh to block the search request until all shard and replicas refresed?

There isn't an option to block _concurrent_ searches behind the refresh. You'd have to do that yourself. In 5.0 there is any option on index/update/delete that'll block until the change made by that request is visible, though I don't know if it is useful for you: [Where are my documents?\<br\>Refreshing news... | Elastic Blog](https://www.elastic.co/blog/refreshing_news)

---

<div class="post-metadata">

**Author:** ![Deng](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@Deng](https://discuss.elastic.co/u/Deng)\
**Post date:** [August 17, 2016, 7:10am UTC](https://discuss.elastic.co/t/is-it-possible-searching-returned-different-results-when-refreshing/58042/3 "2016-08-17T07:10:11Z")

</div>

Thanks for your reply.  
Then, It seems that setPreference to primay when querying is my only solution.

---

<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, 10:27pm UTC](https://discuss.elastic.co/t/is-it-possible-searching-returned-different-results-when-refreshing/58042/4 "2017-07-05T22:27:22Z")

</div>


