I'd like to filter for EITHER (OR) of two values, but a filter
appears to require (AND) a document to contain EACH value. I'm using a bool
query currently, and should
appears to be the only way to do an OR expression. However, I do not want relevance scores and I want node query caching, which is supported by filter context
(enabled by filter
) not query context
(enabled by should
).
The only ways to get filter context
are described here in the documentation:
Filter context is in effect whenever a query clause is passed to a
filter
parameter, such as thefilter
ormust_not
parameters in thebool
query, thefilter
parameter in theconstant_score
query, or thefilter
aggregation. (Query and filter context | Elasticsearch Guide [8.11] | Elastic)
As you can see, the filter
parameter is required.