Non realtime aspects of ES

I notice that if I update a document in ES and then immediately query, the change is not reflected. If I query a 2nd time, say 500ms later, the change is reflected. Is this expected behavior? If so, is there a way I can get a callback from ES using the elasticsearch NPM module that only calls me back with success or failure once the change is permanent and queriable by subsequent queries?

This is expected. This is how refresh works.

You can wait for the next refresh if needed with refresh=wait_for

See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-refresh.html

https://www.elastic.co/guide/en/elasticsearch/guide/2.x/inside-a-shard.html has a good background on this.

Thanks. I’ll read up on this.

Awesome, thanks Mark. I’ll check this out.

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