gpt4 book ai didi

Elasticsearch:通过查询删除在很多文档上删除真的很慢

转载 作者:行者123 更新时间:2023-11-29 02:55:36 24 4
gpt4 key购买 nike

我正在使用 delete by query Elasticsearch 插件。

我有一个索引products,其中包含一个整数字段size。我想删除所有大小为 10 的文档。我有超过 5000 个大小为 10 的文档。如果我尝试:

DELETE /products/product/_query?q=size:10

此查询需要超过 2 分钟。

我理解是因为delete by query 插件很慢,来自documentation :

Internally, it uses Scroll and Bulk APIs to delete documents in an efficient and safe manner. It is slower [..] Queries which match large numbers of documents may run for a long time, as every document has to be deleted individually.

如何执行最快的文档批量删除?

最佳答案

你不能。这是最新版本的 Elasticsearch 中唯一支持的删除文档的方法。 Elasticsearch 1.x 删除速度更快(但可能以不安全的方式)。所以如果真的值那么多钱,你可以回到旧版本的 Elasticsearch。

关于Elasticsearch:通过查询删除在很多文档上删除真的很慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39384770/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com