I'd like to use the bulk update api with a script, but i would like to apply the update via a query- and not an id.
A standard bulk-update payload looks something like this-
{
"_index": "users",
"_type": "user",
"_op_type": "update",
"_id": "123",
"script": { ... }
}
But i'd like to instead replace the _id
property with a query-
{
"_index": "users",
"_type": "user",
"_op_type": "update",
"_query": {"query": {"range": {"age": {"gte": 30}}}},
"script": { ... }
}
Is this possible with the bulk update api? Do I need to run this as a standard update via script api request?
I don't think this is possible with bulk API. What I think you really need is update_by_query method. For more details, check examples in the documentation.