Skip to main content
A query that matches documents based on boolean combinations of other queries. The boolean query maps to Lucene BooleanQuery.

Boolean query array parameters

When used within a bool query array, each object can contain: It is built using one or more boolean clauses, each clause with a typed occurrence. The occurrence types are:

Occur

For example, two should clauses match documents satisfying either clause. Adding a filter changes that behavior: the filter determines which documents can match, and the should clauses only affect their scores. Use must when a clause must match even alongside a filter. These rules apply independently at each nested bool level.

Boost

Boost values that are less than 1.0 will give less importance to this query compared to other ones while values that are greater than 1.0 will give more importance to the scores returned by this query.

Examples

The examples are query objects. Place them under the request body’s top-level query, alongside size and other search options. A filter-only boolean query cannot use native reranking.

Boolean query with occur

The filter requires node_type:NODE. The optional should clause boosts matching content:LambdaDB documents; it does not require every returned document to contain that term. Use occur: "must" for that clause if both conditions must match.

Boolean query with boost

The boost value must be greater than zero.
The final score of the matched document is calculated as proportional to the boost values.