In the previous chapter, we saw how to update a document in the Update a document recipe.
The update_by_query API call allows the user to execute the update on all the documents that match a query. It is very useful if you need to do the following:
- Reindex a subset of your records that match a query. It's common if you change your document mapping and need the documents to be reprocessed.
- Update values of your records that match a query.
It's the Elasticsearch version of the SQL update command.
This functionality is provided by an additional module called reindex that is installed by default.