如何在elasticsearch中等待重新索引? [英] How to wait for reindexing in elasticsearch?

查看:54
本文介绍了如何在elasticsearch中等待重新索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个设置了索引 posts ElasticSearch .我不时向其推送新文档.

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

我希望 ElasticSearch 仅在对所有文档建立索引后才回复我的查询.我该怎么办?

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

推荐答案

在ES 2中,您可以调用

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.

在ES5中,您将能够使用

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.

这篇关于如何在elasticsearch中等待重新索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆