# Indices.queries.cache.size come from the heap?

**URL:** <https://discuss.elastic.co/t/indices-queries-cache-size-come-from-the-heap/93027>\
**Category:** Elasticsearch\
**Created:** [July 13, 2017, 2:18pm UTC](https://discuss.elastic.co/t/indices-queries-cache-size-come-from-the-heap/93027 "2017-07-13T14:18:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![red888](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@red888](https://discuss.elastic.co/u/red888)\
**Post date:** [July 13, 2017, 2:18pm UTC](https://discuss.elastic.co/t/indices-queries-cache-size-come-from-the-heap/93027/1 "2017-07-13T14:18:56Z")

</div>

Does indices.queries.cache.size come out of the JVM heap or free memory not used by the JVM?

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [July 14, 2017, 6:27am UTC](https://discuss.elastic.co/t/indices-queries-cache-size-come-from-the-heap/93027/2 "2017-07-14T06:27:04Z")

</div>

The query cache caches queries in the jvm heap.

---

<div class="post-metadata">

**Author:** ![red888](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@red888](https://discuss.elastic.co/u/red888)\
**Post date:** [July 14, 2017, 12:08pm UTC](https://discuss.elastic.co/t/indices-queries-cache-size-come-from-the-heap/93027/3 "2017-07-14T12:08:36Z")

</div>

I guess I'm surprised I thought I read that left over memory (not assigned to the JVM) was used by Lucene for caching related functions or that can improve search performance. Is this not the case?

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [July 14, 2017, 12:58pm UTC](https://discuss.elastic.co/t/indices-queries-cache-size-come-from-the-heap/93027/4 "2017-07-14T12:58:15Z")

</div>

Yes, this the case. Lucene relies a lot on the file system cache for data structures, for example like the inverted index for searching. This is the reason that uncached queries are fast too. The query cache is however different, at query time for specific queries the intermediate query results (as bitsets) are stored on the jvm heap, so that in certain cases Lucene doesn't need to recompute results for certain parts of the query.

---

<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:** [August 11, 2017, 12:58pm UTC](https://discuss.elastic.co/t/indices-queries-cache-size-come-from-the-heap/93027/5 "2017-08-11T12:58:29Z")

</div>

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