我希望通过脚本使用批量更新api,但我希望通过查询而不是id来应用更新。
一个标准的批量更新负载看起来像这样-
{
"_index": "users",
"_type": "user",
"_op_type": "update",
"_id": "123",
"script": { ... }
}但是我想用一个查询替换_id属性-
{
"_index": "users",
"_type": "user",
"_op_type": "update",
"_query": {"query": {"range": {"age": {"gte": 30}}}},
"script": { ... }
}使用批量更新api可以做到这一点吗?我是否需要通过脚本api请求将其作为标准更新运行?
发布于 2019-04-24 02:46:19
我不认为使用bulk API可以做到这一点。我认为你真正需要的是update_by_query方法。有关更多详细信息,请查看documentation中的示例。
https://stackoverflow.com/questions/55814528
复制相似问题