Filter cache - based on full set or result of previous filters?

2014-11-11 Thread Lasse Schou
Hi, I have a search request that uses a couple of filters. I'm using bool+must, and I'm trying to optimize the request as much as possible. - Some filters are used by all users of my platform, but aren't very selective. - Some filters are very specific to individual users, and are highly

Re: Filter cache - based on full set or result of previous filters?

2014-11-11 Thread Ivan Brusic
The status filter cache will indeed contain all entries. And technically, the cache is per segment, and not across all documents, but this should be transparent. Caching is enabled by default for the term filters, but disabled for the bool filter. You can enable it if you think users will be

Re: Filter cache - based on full set or result of previous filters?

2014-11-11 Thread Lasse Schou
Thanks for the explanation. A follow-up question. If caching the filter for a specific value, say { term: { status: paid } }, will this somehow magically speed up the query if searching for status: unpaid? I'm not talking about a not operation, but simply replacing the value with something else

Re: Filter cache - based on full set or result of previous filters?

2014-11-11 Thread Nikolas Everett
Term filters already use lucene's term dictionary as an index. Almost everything Elasticsearch does uses it. In fact term queries are so fast that Elasticsearch switched them from being cached by default to uncached by default (don't have version number handy). For the most part I wouldn't worry