每当我们从 Elasticsearch 集群中删除一些项目时,我们是否应该每次都清除滚动条?如果我们不这样做,会有什么影响?
我在一些示例代码中看到,对于删除,在删除项目之前,它首先搜索元素,然后清除滚动条。
最佳答案
来自 Elasticsearch documentation :
The results that are returned from a scroll request reflect the state of the index at the time that the initial search request was made, like a snapshot in time. Subsequent changes to documents (index, update or delete) will only affect later search requests.
因此,您不需要删除滚动上下文。事实上,您永远不需要删除上下文,因为它最终会自行删除。但是,最佳做法是在完成释放资源后删除滚动上下文。
您描述的情况的一个用例是查看程序是否仍在使用过时的文档。根据代码的不同,您可能不希望它使用已删除的文档,而是希望检索新的滚动上下文。
关于amazon-web-services - 从 Elasticsearch 中删除元素时清除滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57729647/