Updating by query
In Chapter 3, Basic Operations we saw how to update a document in the Update a document recipe.
The update_by_query
API call allows the user to execute an 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. This is very common if you change your document mapping and need the documents to be reprocessed.
- Update the values of your records that match a query.
This is the Elasticsearch version of the SQL update command.
This functionality is provided by an additional module, called reindex, which is installed by default.Â
Getting ready
You will need an up-and-running Elasticsearch installation, as described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute these commands, any HTTP client can be used, such as Curl (https://curl.haxx.se/), Postman (https://www.getpostman...