Is filteredQuery cached in any way?

I am using a filteredQuery and I was wondering whether it does any caching of either the interior query or the filter. For example if I do (in java) QueryBuilders.filteredQuery(query, filterBuilder) is the result of the filter applied to the query cached (or is anything cached in that scenario)?


this depends a bit on the version of ES you are using and also on the type of query that is wrapped as a filter. As a general guideline most "leaf filters" (those directly targeting a field in your documents) are cached in 1.x with some noteable exceptions described here. In 2.x the caching behaviour is more automatic to avoid overcaching. See this blog post for some detailed explanations.