Caching - general idea?


(Andrej) #1

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


(Shay Banon) #2

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 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


(system) #3