批量向弹性搜索索引中的所有文档添加新字段(Bulk add new field to ALL documents in an elasticsearch index)

编程入门 行业动态 更新时间:2024-10-21 09:25:46
批量向弹性搜索索引中的所有文档添加新字段(Bulk add new field to ALL documents in an elasticsearch index)

我需要在索引中的所有文档中添加一个新字段,而不需要下拉文档并将其推回(这将需要大约一天)。 是否可以使用_BULK api来实现这一目标?

我还研究过update_by_query插件,它似乎只需要将它们拉下来并自己推回它们。

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?

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,请执行扫描并滚动 ,并将fields参数设置为空数组。

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.

更多推荐

本文发布于:2023-08-01 02:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1353772.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   批量   弹性   索引   文档

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!