How To Solve Issues Related to Log – Bulk request has been cancelled.

Improve Your Elasticsearch Configuration

No Installation Required
No Security Risk
3 Free Minute Process !

No Installation

Updated: Jan-20

In-Page Navigation (click to jump) :

Opster Offer’s World-Class Elasticsearch Expertise In One Powerful Product
Try Our Free Elasticsearch Check-Up   Fix Painful Mistakes !

Troubleshooting background

To troubleshoot Elasticsearch log “Bulk request has been cancelled.” it’s important to understand common problems related to Elasticsearch concepts: bulk, handler, request. See detailed explanations below complete with common problems, examples and useful tips.

Bulk in Elasticsearch

What it is

In Elasticsearch, when using the Bulk API it is possible to perform many write operations in a single API call, which increases the indexing speed. Using the Bulk API is more efficient than sending multiple, separate requests. This can be done for the following four actions:

  • Index
  • Update
  • Create 
  • Delete
Examples

The bellow bulk request will index a document, delete another document, and update an existing document.

POST _bulk
{ "index" : { "_index" : "myindex", "_id" : "1" } }
{ "field1" : "value" }
{ "delete" : { "_index" : “myindex", "_id" : "2" } }
{ "update" : {"_id" : "1", "_index" : "myindex"} }
{ "doc" : {"field2" : "value5"} }
Notes
  • Bulk API is useful when you need to index data streams that can be queued up and indexed in batches of hundreds or thousands, such as logs.
  • There is no correct number of actions or limits to perform on a single bulk call, but you will need to figure out the optimum number by experimentation, given the cluster size, number of nodes, hardware specs etc.


To help troubleshoot related issues we have gathered selected Q&A from the community and issues from Github , please review the following for further information :

1 Elasticsearch bulk insert with NEST returns es_rejected_execution_exception 1.40 K 1

2Java Application Using Bulkprocessi  


Log Context

Log ”Bulk request {} has been cancelled.” classname is BulkRequestHandler.java
We have extracted the following from Elasticsearch source code to get an in-depth context :

             if (concurrentRequests == 0) {
                latch.await();
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            logger.info(() -> new ParameterizedMessage("Bulk request {} has been cancelled."; executionId); e);
            listener.afterBulk(executionId; bulkRequest; e);
        } catch (Exception e) {
            logger.warn(() -> new ParameterizedMessage("Failed to execute bulk request {}."; executionId); e);
            listener.afterBulk(executionId; bulkRequest; e);
        } finally {






About Opster

Opster identifies and predicts root causes of Elasticsearch problems, provides recommendations and can automatically perform various actions to prevent issues, optimize performance and save resources.

Learn more: Glossary | Blog| Troubleshooting guides | Error Repository

Need help with any Elasticsearch issue ? Contact Opster