# Cause of doc\_values\_memory\_in\_bytes and how to reduce?

**URL:** <https://discuss.elastic.co/t/cause-of-doc-values-memory-in-bytes-and-how-to-reduce/51351>\
**Category:** Elasticsearch\
**Created:** [May 30, 2016, 10:32pm UTC](https://discuss.elastic.co/t/cause-of-doc-values-memory-in-bytes-and-how-to-reduce/51351 "2016-05-30T22:32:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevan](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@trevan](https://discuss.elastic.co/u/trevan)\
**Post date:** [May 30, 2016, 10:32pm UTC](https://discuss.elastic.co/t/cause-of-doc-values-memory-in-bytes-and-how-to-reduce/51351/1 "2016-05-30T22:32:01Z")

</div>

We just recently upgraded to ES 2.3.1 from ES 1.7.3 and we had memory issues a few days later. Besides the fact that we have a lot of shards ([Why is my heap usage always high?](https://discuss.elastic.co/t/why-is-my-heap-usage-always-high/45017)), I also noticed that the doc\_values\_memory\_in\_bytes value went up at the same time. It appears that that value is what caused us to go into memory issues.

I'm wondering what that value is since I was under the impression that doc\_values was all on disk. And how can I clear that memory programmatically?

---

<div class="post-metadata">

**Author:** ![kartiku](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kartiku/32/11844_2.png) [@kartiku](https://discuss.elastic.co/u/kartiku)\
**Post date:** [March 9, 2017, 6:00pm UTC](https://discuss.elastic.co/t/cause-of-doc-values-memory-in-bytes-and-how-to-reduce/51351/2 "2017-03-09T18:00:05Z")

</div>

The file system will load the doc\_values into the cache, that's what is eating up the memory. Elasticsearch will use doc\_values, but retrieval will be faster if it doesn't actually have to hit the disk to read those values. Hope that helps.

---

<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, 10:02pm UTC](https://discuss.elastic.co/t/cause-of-doc-values-memory-in-bytes-and-how-to-reduce/51351/3 "2017-07-05T22:02:22Z")

</div>


