# BulkProcessor afterBulk method not getting invoked when cluster is Red

**URL:** <https://discuss.elastic.co/t/bulkprocessor-afterbulk-method-not-getting-invoked-when-cluster-is-red/192884>\
**Category:** Elasticsearch\
**Created:** [July 30, 2019, 11:19am UTC](https://discuss.elastic.co/t/bulkprocessor-afterbulk-method-not-getting-invoked-when-cluster-is-red/192884 "2019-07-30T11:19:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PDN10](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pdn10/32/51227_2.png) [@PDN10](https://discuss.elastic.co/u/PDN10)\
**Post date:** [July 30, 2019, 11:19am UTC](https://discuss.elastic.co/t/bulkprocessor-afterbulk-method-not-getting-invoked-when-cluster-is-red/192884/1 "2019-07-30T11:19:42Z")

</div>

I got into a situation where long running queries on cluster made CPU utilization to go high on all nodes. And cluster went into Red.

We have an application which constantly Indexes documents in Elasticsearch using BulkProcessor. BulkProcessor listners afterBulk method handles failures if any and retries those documents.

During the cluster red scenario, we found that the BulkProcessor listner's afterBulk methods (afterBulk(executionId: Long, request: BulkRequest, failure: Throwable) and afterBulk(executionId: Long, request: BulkRequest, response: BulkResponse)) are not invoked. And hence no retry happened. Ultimately causing data loss.

My question is how to ensure listener's afterBulk is always called even is cluster is in Red state.  
Or How bulk processor can know cluster failure and stop excecution

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 27, 2019, 11:19am UTC](https://discuss.elastic.co/t/bulkprocessor-afterbulk-method-not-getting-invoked-when-cluster-is-red/192884/2 "2019-08-27T11:19:44Z")

</div>

Closed on August 27, 2019, 11:19am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
