# Clear cache on demand and Circuit breaker Problem

**URL:** https://discuss.elastic.co/t/clear-cache-on-demand-and-circuit-breaker-problem/17473
**Category:** Elasticsearch
**Created:** [May 13, 2014, 8:03am UTC](https://discuss.elastic.co/t/clear-cache-on-demand-and-circuit-breaker-problem/17473 "2014-05-13T08:03:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Thomas\_Bolis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_bolis/32/700_2.png) [@Thomas\_Bolis](https://discuss.elastic.co/u/Thomas_Bolis)
#### Post date: [May 13, 2014, 8:03am UTC](https://discuss.elastic.co/t/clear-cache-on-demand-and-circuit-breaker-problem/17473/1 "2014-05-13T08:03:54Z")

</div>

Hi,

I'm trying to get some aggregated information by Querying Elasticsearch via  
my app. What I notice is that after some time I get a CircuitBreaker  
exception and my query fails. I can assume that I load too many fielddata  
and eventually the CircuitBreaker stops my query. Inside my application I  
have a logic where I do the query sequentially by time. For example I split  
the query with a range if two hours to every half hour, hence instead of  
doing one query for the full two hours period I do 4 queries of half hour  
each. And this is something I can configure.

My Question is whether it has a meaning to perform a clearCache request  
between my requests (or every 15 minutes for instance) in order to avoid  
CircuitBreaker exception. I know I will make it slower but to my mind it is  
better to perform a bit poorly rather than stopping the operation. Knowing  
that the query remains the same (with different parameters) does this have  
a meaning ? or I will end up deleting and creating the same cache again and  
again?

client.admin().indices().prepareClearCache(indexName).get();

Other alternatives here to avoid circuitbreaker in the most efficient way?  
Of course if I leave it unbounded I eventually get a heap space exception..

Thank you

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d093c6df-b40b-4704-b0dd-c6bc300299c3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d093c6df-b40b-4704-b0dd-c6bc300299c3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:29am UTC](https://discuss.elastic.co/t/clear-cache-on-demand-and-circuit-breaker-problem/17473/2 "2017-07-06T01:29:54Z")

</div>


