Updating a document
Documents stored in Elasticsearch can be updated during their lives. There are two available solutions for performing this operation in Elasticsearch: adding a new document or using the update call.
The update call can work in two ways:
- By providing a script that uses the update strategy
- By providing a document that must be merged with the original one
The main advantage of updating versus using an index is the networking reduction and the increased possibility of reducing conflicts due to concurrent changes.
Getting ready
You will need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute the commands in this recipe, you can use any HTTP client, such as curl (https://curl.haxx.se/), Postman (https://www.getpostman.com/), or others. I suggest using the Kibana console as it provides code completion and better character escaping for...