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 the process, ElasticSearch allow to execute bulk CRUD (Create, Read, Update, Delete) calls.

Getting ready

You will need a working ElastiSearch cluster.

How to do it...

As we are changing the state of the data, the HTTP method is POST and the REST URL is:

http://<server>/<index_name/_bulk

To execute a bulk action, we will perform the steps given as follows:

  1. We need to collect the Create, Index, Delete, Update commands in a structure made of bulk JSON lines, composed by a line of action with metadata and another line with optional data related to the action. Every line must end with a newline, ...

Get ElasticSearch Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.