简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM