# BulkProcessor.awaitClose() on returning false

**URL:** <https://discuss.elastic.co/t/bulkprocessor-awaitclose-on-returning-false/117747>\
**Category:** Elasticsearch\
**Created:** [January 31, 2018, 7:11am UTC](https://discuss.elastic.co/t/bulkprocessor-awaitclose-on-returning-false/117747 "2018-01-31T07:11:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyasso](https://avatars.discourse-cdn.com/v4/letter/e/e68b1a/32.png) [@eyasso](https://discuss.elastic.co/u/eyasso)\
**Post date:** [January 31, 2018, 7:11am UTC](https://discuss.elastic.co/t/bulkprocessor-awaitclose-on-returning-false/117747/1 "2018-01-31T07:11:29Z")

</div>

Hi,

if BulkProcessor.awaitClose() returns false, can I tell which messages elastic managed to index so far?  
I am asking this because in my code I am waiting on bulkProcessor.awaitClose(). If it fails (timeout), i would like to retry index the messages. However, I don't want to re-index messages elastic indexed.

Thanks,

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 31, 2018, 9:53am UTC](https://discuss.elastic.co/t/bulkprocessor-awaitclose-on-returning-false/117747/2 "2018-01-31T09:53:44Z")

</div>

I guess that the listener and the method `afterBulk` could help here?

---

<div class="post-metadata">

**Author:** ![eyasso](https://avatars.discourse-cdn.com/v4/letter/e/e68b1a/32.png) [@eyasso](https://discuss.elastic.co/u/eyasso)\
**Post date:** [January 31, 2018, 10:04am UTC](https://discuss.elastic.co/t/bulkprocessor-awaitclose-on-returning-false/117747/3 "2018-01-31T10:04:54Z")

</div>

That what I would expect to be, but they are not invoked.  
They are called in success or fail, but not if awaitClose returns false.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 31, 2018, 10:30am UTC](https://discuss.elastic.co/t/bulkprocessor-awaitclose-on-returning-false/117747/4 "2018-01-31T10:30:58Z")

</div>

M'y assumption is that if the listener is not called you can assume that the documents have not been processed.

---

<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:** [February 28, 2018, 10:31am UTC](https://discuss.elastic.co/t/bulkprocessor-awaitclose-on-returning-false/117747/5 "2018-02-28T10:31:35Z")

</div>

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