Caching AND filter

Hi,

I'm trying to cache an AND filter, because it is used to define a scope for almost all queries. However, I can't get it to work.
Context:

  • ES 0.17.6
  • single node.
  • 3Mio+ documents in the index of the same type.

I made a gist of the query and the accompanying response: https://gist.github.com/cb4db4d846b27b94501e.
The documentation about the _cache for the and filter does not state explicitly how to use the cache.

Can someone help me with using the _cache in the right way?

Thanks, Jasper

In this case, the "and" element should have an inner "filters" object in it
to enable caching, something like:

"and" : { "filters" : [ ... ], "_cache" : true }

Thats because you can't place another "setting" / field into a case with:
"and" : [...]

On Wed, Aug 24, 2011 at 7:52 PM, Jasper van Wanrooy - Chatventure <
jvanwanrooy@chatventure.com> wrote:

Hi,

I'm trying to cache an AND filter, because it is used to define a scope for
almost all queries. However, I can't get it to work.
Context:

  • ES 0.17.6
  • single node.
  • 3Mio+ documents in the index of the same type.

I made a gist of the query and the accompanying response:
Caching AND filter in Elasticsearch · GitHub.
The documentation about the _cache for the and filter does not state
explicitly how to use the cache.

Can someone help me with using the _cache in the right way?

Thanks, Jasper
*
*

Thanks for your fast response Shay. Does this work the same way for all filters which need to be cacheable? Then I can implement it properly into Elastica.

Thanks, Jasper

On 24 aug. 2011, at 19:32, Shay Banon wrote:

In this case, the "and" element should have an inner "filters" object in it to enable caching, something like:

"and" : { "filters" : [ ... ], "_cache" : true }

Thats because you can't place another "setting" / field into a case with: "and" : [...]

On Wed, Aug 24, 2011 at 7:52 PM, Jasper van Wanrooy - Chatventure jvanwanrooy@chatventure.com wrote:
Hi,

I'm trying to cache an AND filter, because it is used to define a scope for almost all queries. However, I can't get it to work.
Context:

  • ES 0.17.6
  • single node.
  • 3Mio+ documents in the index of the same type.

I made a gist of the query and the accompanying response: Caching AND filter in Elasticsearch · GitHub.
The documentation about the _cache for the and filter does not state explicitly how to use the cache.

Can someone help me with using the _cache in the right way?

Thanks, Jasper

Its the same _cache flags on all filters (though different filters have
different default value for it). But, for filters that have a short form,
like the and filter, then a specific longer form is also available that
allows to explicitly set the _cache flag. You can use the longer form always
in a client lib you build on top of elasticsearch, which should simplify
things.

The docs should include samples (where missing), for special cases _cache
flag setting, such as the case with the and filter. Lemme try and update
them where its relevant.

On Wed, Aug 24, 2011 at 11:52 PM, Jasper van Wanrooy - Chatventure <
jvanwanrooy@chatventure.com> wrote:

Thanks for your fast response Shay. Does this work the same way for all
filters which need to be cacheable? Then I can implement it properly into
Elastica.

Thanks, Jasper

On 24 aug. 2011, at 19:32, Shay Banon wrote:

In this case, the "and" element should have an inner "filters" object in it
to enable caching, something like:

"and" : { "filters" : [ ... ], "_cache" : true }

Thats because you can't place another "setting" / field into a case with:
"and" : [...]

On Wed, Aug 24, 2011 at 7:52 PM, Jasper van Wanrooy - Chatventure <
jvanwanrooy@chatventure.com> wrote:

Hi,

I'm trying to cache an AND filter, because it is used to define a scope
for almost all queries. However, I can't get it to work.
Context:

  • ES 0.17.6
  • single node.
  • 3Mio+ documents in the index of the same type.

I made a gist of the query and the accompanying response:
Caching AND filter in Elasticsearch · GitHub.
The documentation about the _cache for the and filter does not state
explicitly how to use the cache.

Can someone help me with using the _cache in the right way?

Thanks, Jasper
*
*