# Indices.fielddata.cache.size and indices.breaker.fielddata.limit

**URL:** https://discuss.elastic.co/t/indices-fielddata-cache-size-and-indices-breaker-fielddata-limit/43548
**Category:** Elasticsearch
**Created:** [March 4, 2016, 8:07pm UTC](https://discuss.elastic.co/t/indices-fielddata-cache-size-and-indices-breaker-fielddata-limit/43548 "2016-03-04T20:07:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)
#### Post date: [March 4, 2016, 8:07pm UTC](https://discuss.elastic.co/t/indices-fielddata-cache-size-and-indices-breaker-fielddata-limit/43548/1 "2016-03-04T20:07:07Z")

</div>

Hi all,

I spent some time reading the [https://www.elastic.co/guide/en/elasticsearch/guide/current/\_limiting\_memory\_usage.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/_limiting_memory_usage.html), but I still found the concept confusing. I come up with some intepretation/statements, and I hope you can confirm if they are correct.

First of all, by default `indices.fielddata.cache.size` is unbound or not set - no fielddata eviction , which means that a query with values loaded into fielddata bigger than HEAP size will cause OOM exception and lead to node death.

So to prevent OOM that kills an ES node, we may set `indices.fielddata.cache.size` to a value such as `70%`. "With this setting in place, the least recently used fielddata will be evicted to make space for newly loaded data." So as fielddata is full, it will evict old values to give place for new ones requested by a query.

Yet there is another problem with using only `indices.fielddata.cache.size` because `fielddata size is checked after the data is loaded`. In other words, if a new query comes in with values loaded into fielddata larger than `70%`, says `100%`, OMM still occurs even if fielddata evicts all old values.

Again, to solve this problem, ES use `indices.breaker.fielddata.limit`. It is recommended to set `indices.breaker.fielddata.limit` higher than `indices.fielddata.cache.size`, so `indices.breaker.fielddata.limit` serves as a safe net to prevent OOM.

If we set `indices.breaker.fielddata.limit` to `80%`, circuit breaker check the value size before loading, so if values reach `80%`, above the `70%` that fielddata.cache.size can handle, the query will be aborted with an exception, but no OOM.

In summary:

- We should set `indices.fielddata.cache.size` to a certain value (lower than `indices.breaker.fielddata.limit`) to allow us to run queries accesing new value when fielddata is full
- The default `indices.breaker.fielddata.limit` is a safe net to prevent OOM.

Are the interpretations above correct?

Thanks,  
Anh

---

<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 5, 2017, 11:11pm UTC](https://discuss.elastic.co/t/indices-fielddata-cache-size-and-indices-breaker-fielddata-limit/43548/2 "2017-07-05T23:11:06Z")

</div>


