# Caching of documents

**URL:** <https://discuss.elastic.co/t/caching-of-documents/9886>\
**Category:** Elasticsearch\
**Created:** [November 29, 2012, 12:40pm UTC](https://discuss.elastic.co/t/caching-of-documents/9886 "2012-11-29T12:40:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roman\_Kournjaev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roman_kournjaev/32/2552_2.png) [@Roman\_Kournjaev](https://discuss.elastic.co/u/Roman_Kournjaev)\
**Post date:** [November 29, 2012, 12:40pm UTC](https://discuss.elastic.co/t/caching-of-documents/9886/1 "2012-11-29T12:40:47Z")

</div>

Hi

How elastic caches queries ? what is the common algorithm LRU ??? Something  
else ?

Thanks  
Roman

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [November 29, 2012, 3:12pm UTC](https://discuss.elastic.co/t/caching-of-documents/9886/2 "2012-11-29T15:12:49Z")

</div>

Hello Roman,

On Thu, Nov 29, 2012 at 2:40 PM, Roman Kournjaev [kournjaev@gmail.com](mailto:kournjaev@gmail.com)wrote:

> Hi
> 
> How elastic caches queries ?

It only caches filters and document fields, as far as I know. Some filters  
are cached by default, some aren't, but you can control that by setting  
\_cache to either true or false.

> what is the common algorithm LRU ??? Something else ?

Yes, LRU. And there are some settings which you can tune to control both  
filter caches and field data caches:

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

You might also find this article on caching really interesting:

> **[Sematext ElasticSearch Services](https://sematext.com/elasticsearch)**
>
> Optimize your Elasticsearch performance with Sematext. Get real-time monitoring, logging, and troubleshooting to ensure peak efficiency.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

--

---

<div class="post-metadata">

**Author:** ![Benoit](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Benoit](https://discuss.elastic.co/u/Benoit)\
**Post date:** [November 30, 2012, 9:51am UTC](https://discuss.elastic.co/t/caching-of-documents/9886/3 "2012-11-30T09:51:10Z")

</div>

Hi,

Elasticsearch use the cache objects of the Guava library. (Mentioned by  
Ivan Brusic here  
[https://groups.google.com/d/msg/elasticsearch/OLwmBRVaScc/bR4nWreSVgcJ](https://groups.google.com/d/msg/elasticsearch/OLwmBRVaScc/bR4nWreSVgcJ) )

Reading this page is really interesting :

> **[GitHub - google/guava: Google core libraries for Java](https://github.com/google/guava)**
>
> Google core libraries for Java. Contribute to google/guava development by creating an account on GitHub.

Regards.

Benoît

On Thursday, November 29, 2012 4:12:49 PM UTC+1, Radu Gheorghe wrote:

> Hello Roman,
> 
> On Thu, Nov 29, 2012 at 2:40 PM, Roman Kournjaev \<[kour...@gmail.com](mailto:kour...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi
> > 
> > How elastic caches queries ?
> 
> It only caches filters and document fields, as far as I know. Some filters  
> are cached by default, some aren't, but you can control that by setting  
> \_cache to either true or false.
> 
> > what is the common algorithm LRU ??? Something else ?
> 
> Yes, LRU. And there are some settings which you can tune to control both  
> filter caches and field data caches:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/cache.html)
> 
> You might also find this article on caching really interesting:  
> [ElasticSearch Cache Usage - Sematext](http://blog.sematext.com/2012/05/17/elasticsearch-cache-usage/)
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

--

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [November 30, 2012, 5:18pm UTC](https://discuss.elastic.co/t/caching-of-documents/9886/4 "2012-11-30T17:18:28Z")

</div>

Queries for themselves are not cached between executions, whereas query  
results are cached, as Radu and Benoît explained.

Best regards,

Jörg

On Thursday, November 29, 2012 1:40:47 PM UTC+1, Roman Kournjaev wrote:

> Hi
> 
> How elastic caches queries ? what is the common algorithm LRU ???  
> Something else ?
> 
> Thanks  
> Roman

--

---

<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, 3:01am UTC](https://discuss.elastic.co/t/caching-of-documents/9886/5 "2017-07-06T03:01:57Z")

</div>


