Closed
Description
The way terms
filter currently executes is by iterating over the terms provided and finding matches docs (loading into a bitset) and caching it. Sometimes, we want a different execution model that can still be achieved by building more complex queries in the DSL, but would be nice to support them in the more compact model that terms
filter provides.
The execution
option now has the following options :
plain
: The default. Works as today. Iterates over all the terms, building a bit set matching it, and filtering. The total filter is cached (keyed by the terms).bool
: Builds abool
filter wrapping each term in aterm
filter that is cached. The bool filter is optimized in this case since it bitwise or's the different term filter bitsets. The total filter is not cached by default in this case.and
: Builds anand
filter wrapping each term interm
filter that is cached. The total filter is not cached by default in this case. Most times,bool
should be used as its faster thanks to its bitwise execution.
The "total" terms filter caching can still be explicitly controlled using the _cache
option. Note the default value for it depends on the execution
value.