How Refresh works between primary and replica shards

How the refresh works between primary and replica shards
1.When the refresh happen on index.Does primary and replica shards refresh will happen in synchronous way? or After this indexing can happen asynchronously.

No, refresh is not synchronized between the different copies of a shard.

Thanks for the quick reply. But then their is high chance that queries results will vary ,as both primary replica shards are not synchronized.

How does elasticsearch ensure,everytime,it will results the same query results ,with this approach please?

Some times in our environment,we observed difference in doc_count from primary and replica.Is it because of that?

It doesn't. If you're indexing documents then queries at different times will naturally return different results, even if your index only has one copy of each shard.

No my question was. If both are happening in asynchronous fashion.
Then there is a chance where the data which is coming from primary shard ,that data might not be available in replica shard at that particular point of time.
So data which it displayed will be lost ,if we refresh the page,that will create lot of problems for usability know?

In practice I don't think it's such a big deal. By default the different copies won't deviate by more than approximately a second's worth of traffic since that's the default refresh interval. If even this is too much then you can use ?preference=$SESSION_ID to direct each session to the same collection of shard copies across multiple requests.

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