# Handle Failures in Bulk Processor

**URL:** <https://discuss.elastic.co/t/handle-failures-in-bulk-processor/189755>\
**Category:** Elasticsearch\
**Created:** [July 10, 2019, 12:05pm UTC](https://discuss.elastic.co/t/handle-failures-in-bulk-processor/189755 "2019-07-10T12:05:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GPT](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gpt/32/49681_2.png) [@GPT](https://discuss.elastic.co/u/GPT)\
**Post date:** [July 10, 2019, 12:05pm UTC](https://discuss.elastic.co/t/handle-failures-in-bulk-processor/189755/1 "2019-07-10T12:05:01Z")

</div>

Hi All

I need to handle failures and retry for failures in Bulk Processor. BulkProcessor listener has afterBulk methods. For the below method, the response provides a way to extract failures for individual items but it doesn't provide a way to get the passed request. I don't have ID at the time of sending the request. Is there any way to extract the failed request from the BulkItemResponse?

`public void afterBulk(long executionId, BulkRequest request, BulkResponse response)`

Thanks  
Guru

---

<div class="post-metadata">

**Author:** ![GPT](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gpt/32/49681_2.png) [@GPT](https://discuss.elastic.co/u/GPT)\
**Post date:** [July 14, 2019, 6:04am UTC](https://discuss.elastic.co/t/handle-failures-in-bulk-processor/189755/2 "2019-07-14T06:04:13Z")

</div>

I am still trying to figure out a way to get the failed requests, Is there a way to do it?

---

<div class="post-metadata">

**Author:** ![GPT](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gpt/32/49681_2.png) [@GPT](https://discuss.elastic.co/u/GPT)\
**Post date:** [July 14, 2019, 7:03am UTC](https://discuss.elastic.co/t/handle-failures-in-bulk-processor/189755/3 "2019-07-14T07:03:08Z")

</div>

I figured out this from the java doc of getItemID.

"The numeric order of the item matching the same request order in the bulk request."

---

<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 11, 2019, 7:03am UTC](https://discuss.elastic.co/t/handle-failures-in-bulk-processor/189755/4 "2019-08-11T07:03:10Z")

</div>

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