Alex Antonov
Alex Antonov

Reputation: 15156

How to wait for reindexing in elasticsearch?

I have an ElasticSearch with index posts setted up. I'm pushing new documents to it from time to time.

I want ElasticSearch to reply to my queries only when all documents are indexed. How can I do that?

Upvotes: 6

Views: 11605

Answers (1)

Val
Val

Reputation: 217304

In ES 2, you can call the refresh API just after having indexed your new documents, but it's not advised to do it in production as it may decrease the performance of your cluster.

In ES5, you will be able to send your index queries with ?refresh=wait_for and ES will only respond when the new documents are ready to be searched.

Upvotes: 11

Related Questions