A boolean combination of other queries.
BoolQuery maps to Lucene BooleanQuery. It is built using one or more boolean clauses, each clause with a typed occurrence. The occurrence types are:
Occur | Description |
---|---|
must | The clause (query) must appear in matching documents. |
should | The clause (query) should appear in the matching document. A boolean query with no must clauses, one or more should clauses must match a document. The minimum number of should clauses to match can be set using minimum_number_should_match parameter. |
must_not | The clause (query) must not appear in the matching documents. Note that it is not possible to search on documents that only consists of a must_not clauses. |
The bool query also supports disable_coord parameter (defaults to false).
Add a query to the “must” clause of the query.
The Query object will be returned, so calls to this can be chained.
Add a query to the “must_not” clause of the query.
The Query object will be returned, so calls to this can be chained.
Add a query to the “should” clause of the query.
The Query object will be returned, so calls to this can be chained.
Returns a constant score for all documents matching a filter.
Multiple filters may be supplied by passing a sequence or iterator as the filter parameter. If multiple filters are supplied, documents must match all of them to be matched by this query.
Add a filter, or a list of filters, to the query.
If a sequence of filters is supplied, they are all added, and will be combined with an ANDFilter.
Returns True if the query is empty.
Add a parameter
A fuzzy based query that uses similarity based on Levenshtein (edit distance) algorithm.
A percolator query is used to determine which registered PercolatorDoc’s match the document supplied.
Disable this as it is not allowed in percolator queries.
Serialize the query to a structure using the query DSL.
Disable this as it is not allowed in percolator queries.
Base class for all queries.
Return this query wrapped in a Search object.
Any keyword arguments supplied to this call will be passed to the Search object.
Serialize the query to a structure using the query DSL.
Convert the query to JSON using the query DSL.
The output of this is suitable for using as the request body for count, delete_by_query and reindex.
Convert the query to JSON suitable for searching with.
The output of this is suitable for using as the request body for search.
A search to be performed.
This contains a query, and has additional parameters which are used to control how the search works, what it should return, etc.
Add a highlight field.
The Search object will be returned, so calls to this can be chained.
Add a boost on an index.
The Search object will be returned, so calls to this can be chained.
Returns the facet factory
Serialize the search to a structure as passed for a search body.
Convert the search to JSON.
The output of this is suitable for using as the request body for search.
Matches spans which are near one another. One can specify _slop_, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
The clauses element is a list of one or more other span type queries and the slop controls the maximum number of intervening unmatched positions permitted.
Removes matches which overlap with another span query.
The include and exclude clauses can be any span type query. The include clause is the span query whose matches are filtered, and the exclude clause is the span query whose matches must not overlap those returned.
Matches the union of its span clauses.
The clauses element is a list of one or more other span type queries.
Match documents that have fields that contain a term (not analyzed).
A boost may be supplied.
A new family of text queries that accept text, analyzes it, and constructs a query out of it.
Returns if the object is a span query