# Caching - general idea?

**URL:** <https://discuss.elastic.co/t/caching-general-idea/8628>\
**Category:** Elasticsearch\
**Created:** [August 3, 2012, 1:37pm UTC](https://discuss.elastic.co/t/caching-general-idea/8628 "2012-08-03T13:37:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)\
**Post date:** [August 3, 2012, 1:37pm UTC](https://discuss.elastic.co/t/caching-general-idea/8628/1 "2012-08-03T13:37:01Z")

</div>

Hi,

at the moment I am a bit lost about caching, so maybe someone could get me  
a more general view on this topic? What I am trying to do is the following:  
I am using filter with my queries, e.g. GeoPolygonFilter. As those polygons  
can become quite large I dont wont to transmit them (I have to request  
polygons from an external source) and generate filter (adding a large  
number of points) all the time. So keeping those filter in cache would be  
really nice. Using GeoPolygonFilterBuilder it seems I am able to do so, at  
least I can say cache(true) and provide a cachekey. So far, so good. But  
what is happening now? Is there a way for me to find out if a cachekey is  
stored in the cache? How can I use filter in cache, can I retrieve the  
filter from cache or pass cachekey to the query? What are  
CacheKeyFilter.Key and CacheKeyFilterWrapper for? Am I completely wrong? Or  
in general: could someone write down a few sentences about how (filter)  
caching is done in elasticsearch? Unfortunatly documentation (at least what  
I found) is a bit short on this topic.

Thanks in advance!  
Andrej

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 7, 2012, 9:18pm UTC](https://discuss.elastic.co/t/caching-general-idea/8628/2 "2012-08-07T21:18:58Z")

</div>

Thats a different type of caching. The caching with geo polygon (which you probably don't want to use) is to cache the _result_ of the filter so if the same filter (i.e. same parameters) is executed again, it will be fast. Note, the parameters for the geo polygon are still required with this type of caching (since

Regarding not needing to send the geo polygon again, you will probable need to do that caching level outside of ES, so you won't have to ask an external system to get those values again.

On Aug 3, 2012, at 3:37 PM, Andrej Rosenheinrich [andrej.rosenheinrich@unister.de](mailto:andrej.rosenheinrich@unister.de) wrote:

> Hi,
> 
> at the moment I am a bit lost about caching, so maybe someone could get me a more general view on this topic? What I am trying to do is the following: I am using filter with my queries, e.g. GeoPolygonFilter. As those polygons can become quite large I dont wont to transmit them (I have to request polygons from an external source) and generate filter (adding a large number of points) all the time. So keeping those filter in cache would be really nice. Using GeoPolygonFilterBuilder it seems I am able to do so, at least I can say cache(true) and provide a cachekey. So far, so good. But what is happening now? Is there a way for me to find out if a cachekey is stored in the cache? How can I use filter in cache, can I retrieve the filter from cache or pass cachekey to the query? What are CacheKeyFilter.Key and CacheKeyFilterWrapper for? Am I completely wrong? Or in general: could someone write down a few sentences about how (filter) caching is done in elasticsearch? Unfortunatly documentation (at least what I found) is a bit short on this topic.
> 
> Thanks in advance!  
> Andrej

---

<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:17am UTC](https://discuss.elastic.co/t/caching-general-idea/8628/3 "2017-07-06T03:17:26Z")

</div>


