Speeding up atomic operations (bulk operations)
When we are inserting, deleting, or updating a large number of documents, the HTTP overhead is significant. To speed up this process, Elasticsearch allows us to execute the bulk of CRUD calls.
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 Elasticsearch.
How to do it...
Since we are changing the state of the data, we must use the POST
HTTP method. The REST URL will be as follows:
http://<server>/<index_name/_bulk
To execute a bulk action, we will perform the following steps via curl (because it's very common to prepare your...