# Best way to handle "circuit\_breaking\_exception"

**URL:** <https://discuss.elastic.co/t/best-way-to-handle-circuit-breaking-exception/267913>\
**Category:** Elasticsearch\
**Created:** [March 21, 2021, 4:13pm UTC](https://discuss.elastic.co/t/best-way-to-handle-circuit-breaking-exception/267913 "2021-03-21T16:13:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leibo](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@Leibo](https://discuss.elastic.co/u/Leibo)\
**Post date:** [March 21, 2021, 4:13pm UTC](https://discuss.elastic.co/t/best-way-to-handle-circuit-breaking-exception/267913/1 "2021-03-21T16:13:50Z")

</div>

Hi,

Our micro-service is written in Java.

We are facing the "circuit\_breaking\_exception" exception occasionally while trying to index documents from multiple threads.  
How is the best way to handle it without changing any configuration in the Elasticsearch cluster?

Our idea is to catch the exception and try to index the documents again with a random backoff.  
In this way, we won't lose any documents and if there is more than 1 thread that is facing that issue, they will not try to index again at the same time.

What is the best workaround?

---

<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:** [April 18, 2021, 4:14pm UTC](https://discuss.elastic.co/t/best-way-to-handle-circuit-breaking-exception/267913/2 "2021-04-18T16:14:31Z")

</div>

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