# ErrorHandling when using BulkProcessor for delete

**URL:** <https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329>\
**Category:** Elasticsearch\
**Created:** [May 7, 2015, 7:24am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329 "2015-05-07T07:24:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![aasher](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aasher](https://discuss.elastic.co/u/aasher)\
**Post date:** [May 7, 2015, 7:24am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/1 "2015-05-07T07:24:23Z")

</div>

I am Using BulkProcessor for bulk delete.  
How do I get errors if any of the bulks failed?  
Is there an Exception thrown?  
Is there any way to see the bulk, and deleteRequests that failed?

---

<div class="post-metadata">

**Author:** ![Camilo\_Sierra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/camilo_sierra/32/14397_2.png) [@Camilo\_Sierra](https://discuss.elastic.co/u/Camilo_Sierra)\
**Post date:** [May 7, 2015, 8:30am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/2 "2015-05-07T08:30:18Z")

</div>

hello @aasher! when you use bulk, examle in php you call function $res = $this-\>client-\>bulk($data); in @res you have one response for each document that you send, and in the [delete][status] you have code 200 if it works or 400 if it fails, you have also the message why line doesn't work. and they are not exeption thrown, because even if a request fails in the middle all the other request after and before will work.

---

<div class="post-metadata">

**Author:** ![Camilo\_Sierra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/camilo_sierra/32/14397_2.png) [@Camilo\_Sierra](https://discuss.elastic.co/u/Camilo_Sierra)\
**Post date:** [May 7, 2015, 8:33am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/3 "2015-05-07T08:33:40Z")

</div>

even if you dont use any lib (java, php..) but you use curl in your shell you have the same answer !

---

<div class="post-metadata">

**Author:** ![aasher](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aasher](https://discuss.elastic.co/u/aasher)\
**Post date:** [May 7, 2015, 9:11am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/4 "2015-05-07T09:11:33Z")

</div>

Hello Camilo\_Siera! Thank you very much for the quick response.  
I have to user BulkProcessor.add(DeleteRequest)  
and not using BulkRequest.  
The questionis, how do I get the response in this way.  
Thanks again,  
Angela

---

<div class="post-metadata">

**Author:** ![nellicus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nellicus/32/51566_2.png) [@nellicus](https://discuss.elastic.co/u/nellicus)\
**Post date:** [May 7, 2015, 9:57am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/5 "2015-05-07T09:57:10Z")

</div>

Aasher

see [here](https://github.com/elastic/elasticsearch/blob/9b76be92b3f1f9ea735ee9009661379a24065294/docs/java-api/bulk.asciidoc#using-bulk-processor) , specifically number 3 and 4

---

<div class="post-metadata">

**Author:** ![aasher](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aasher](https://discuss.elastic.co/u/aasher)\
**Post date:** [May 7, 2015, 11:00am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/6 "2015-05-07T11:00:51Z")

</div>

Thank you! Exactly what I needed.

---

<div class="post-metadata">

**Author:** ![aasher](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aasher](https://discuss.elastic.co/u/aasher)\
**Post date:** [May 7, 2015, 1:00pm UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/7 "2015-05-07T13:00:22Z")

</div>

Another thing.  
What is the best way to handle the errors. I am getting from BulkRequest the list if the ActionRequest. I need to save those requests for further handling ( maybe try the action again after some time ). How do I save the data? I am using oracle DB.

Thanks,  
Angela

---

<div class="post-metadata">

**Author:** ![nellicus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nellicus/32/51566_2.png) [@nellicus](https://discuss.elastic.co/u/nellicus)\
**Post date:** [May 7, 2015, 1:03pm UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/8 "2015-05-07T13:03:11Z")

</div>

We can't easily tell whether part of the request was successful or or all of it completely failed, say for instance you get a network disconnect.

Probably just repeat the entire request is the way to go.

---

<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:** [July 6, 2017, 12:15am UTC](https://discuss.elastic.co/t/errorhandling-when-using-bulkprocessor-for-delete/329/9 "2017-07-06T00:15:11Z")

</div>


