Update by query API
Similar to a single document update operation using a script, you can use the _update_by_query API to perform the same tasks for all documents that match the given condition in the script. Recall that the process in a single document update operation involves retrieving documents, running scripts, and indexing results. The first step in the _update_by_query API is to take a snapshot of the index, then run the script on the match, and index the resulting document. If any document has changed between the time the snapshot was taken and the time the index request was processed, it will fail due to a version conflict.
Getting the first failure will result in the suspension of the entire operation. However, those updates that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access