Filtering
Narrow search results with boolean expressions over structured fields.
The filter search parameter accepts a small boolean expression language
over fields declared filter: true (or facet: true/sort: true — any of
the three makes a field usable in a filter).
expr := or
or := and ( "||" and )*
and := primary ( "&&" primary )*
primary := "(" expr ")" | predicate
predicate := field ":" op? value
op := "=" | "!=" | ">=" | "<=" | ">" | "<"
value := "[" scalar ".." scalar "]" range, inclusive
| "[" scalar ("," scalar)* "]" set membership
| scalar&& binds tighter than ||. A bare field:value (no operator) means
equality. Strings can be bare, single-, or double-quoted.
Examples
brand:=Logitech && price:<5000(brand:=Logitech || brand:=Razer) && price:[1000..5000]brand:=[Logitech,Razer] && in_stock:=trueprice:[100..500]Ranges ([a..b]) are inclusive on both ends. Set membership ([a,b,c])
matches if the field equals any listed value.
Notes
- Using a field that isn't declared
filter,facet, orsortreturns a400 invalid_queryerror naming the field. !=excludes documents that have no value for the field at all, rather than treating a missing value as a non-match that could still pass.- Filters don't affect ranking — they only narrow the candidate set before BM25 scoring runs.