Managing bulk actions

Executing atomic operation on items via single call is often a bottleneck if you need to index or delete thousands/millions of records. The best practice in this case is to execute a bulk action. We have discussed bulk action via the REST API in the Speeding up atomic operations (bulk operations) recipe in Chapter 4, Basic Operations.

Getting ready

You will need a working ElasticSearch cluster and Maven installed.

The code of this recipe is in chapter_10/nativeclient in the code bundle of this chapter, which is available on Packt's website, and on GitHub (https://github.com/aparo/elasticsearch-cookbook-second-edition). The referred class is BulkOperations.

How to do it...

To manage a bulk action, we will perform the following ...

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.