Caching of filters (from child filters) then reusing later

(phill) #1

Am I correct that any filter can be set to "cache" : "true"?

How does ES realize that the filter is the same?
By the cache_key sure, but if I don't set it what is based on?
What does the page
mean by same "parameters"? Does that include filter types sub filters,
queries etc. and all the settings?

What happens if I use a _cache_key that is not unique?
i.e. What would happen, if I reuse "_cache_key" : "allTheRightDocs"
instead of considering that all unique values for this filter is
different per user etc.?

Can I re-use a cached filter (assuming I get all the above correct) that
I invoked in the filter of a filtered query?
How about if I put a filtered query inside of a has_child filter? After
all it is a filter which returns children.
In this last case, I think I want to make the round trip to back to my
client and then ask for (some of) the children and various fields from
them based on the set of children already identified.
I don't have to use "scope" to do this do I? I'm thinking not, because
the cached filter is a set of children IDs, just what I want the next
time around and I'm not using them in a facet.

"query" : {
"filtered": {
.... filter parents
"filter": {
"has_child" : {
type: "myChildren"
"filtered" : {
"match_all" : { },
"filter" : { <-- we want to save everything in
this filter for the next search request
"and" : {
... all about the children fields and
nothing else
"cache" : "true"



(system) #2