0

I was going through elastic search and wanted to get consistent response from ES clusters.

I read Elasticsearch read and write consistency

https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-index_.html

and some other posts and can conclude that ES returns success to write operation after completing writes to all shards (Primary + replica), irrespective of consistency param.

Let me know if my understanding is wrong.

I am wondering if anyone knows, how does elastic search add a node/shard back into a cluster which was down transiently. Will it start serving read requests immediately after it is available or does it ensures it has up to date data before serving read requests?

I looked for the answer to above question, but could not find any.

Thanks Gopal

Gopal Shukla
  • 157
  • 1
  • 2
  • 10

1 Answers1

0

If node is removed from the cluster and it joins again, Elasticsearch checks if the data is up to date. If it is not, then it will not be made available for search, until it is brought up to date again (which could mean the whole shard gets copied again).

the consistency parameter is just an additional pre-index check if the number of expected shards are available in the cluster (if the index is configured to have 4 replicas, then the primary shard plus two replicas need to be available, if set to quorum). However this parameter does never change the behaviour that a write needs to be written to all available shards, before returning to the client.

alr
  • 1,744
  • 1
  • 10
  • 11
  • Thanks, information is useful. My intention is to use ES and get consistent data. Elastic Search does not ensure that indexed data is immediately available for query. It needs a shard refresh operation which runs in the background every second. We also have the option of doing a refresh with every write operation but it has its own implications. – Gopal Shukla Aug 09 '17 at 01:17
  • dont do a refresh after every write. There has been introduced a `refresh=wait_for` parameter some time ago for this purpose https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docs-refresh.html#docs-refresh – alr Aug 10 '17 at 06:41