问题描述
我需要在索引中为所有文档添加一个新的字段,而不需要拉下文档并将其推回(这将需要大约一天)。我有可能使用_BULK API来实现这一点吗?
I need to add a new field to ALL documents in an index without pulling down the document and pushing it back up (this will take about a day). Is it possible to use the _BULK api to achieve this?
我还研究了update_by_query插件,似乎只要把它们拉下来,他们回来了。
I have also researched the update_by_query plugin, and it seems to would take just as long as pulling them down and pushing them back myself.
推荐答案
是的,批量API支持,可以使用部分文档或脚本添加新字段。要遍历您的文档ID,请执行使用参数集到一个空数组。
Yes, the bulk API supports updates which can add a new field using a partial document or script. To iterate through your document ids do a scan and scroll with the fields parameter set to an empty array.
这篇关于批量向弹性搜索索引中的所有文档添加新字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!