Expand description
Span queries are low-level positional queries which provide expert control over the order and proximity of the specified terms. These are typically used to implement very specific queries on legal documents or patents.
It is only allowed to set boost on an outer span query. Compound span queries, like span_near, only use the list of matching spans of inner span queries in order to find their own spans, which they then use to produce a score. Scores are never computed on inner span queries, which is the reason why boosts are not allowed: they only influence the way scores are computed, not spans.
Span queries cannot be mixed with non-span queries (with the exception of the span_multi query).
Structs§
- Span
Containing Query - Returns matches which enclose another span query. The span containing query maps to Lucene
SpanContainingQuery
.
Thebig
andlittle
clauses can be any span type query. Matching spans frombig
that contain matches fromlittle
are returned. - Span
Field Masking Query - Wrapper to allow span queries to participate in composite single-field span queries by
lying about their search field. The span field masking query maps to Lucene’s
SpanFieldMaskingQuery
- Span
First Query - Matches spans near the beginning of a field. The span first query maps to Lucene
SpanFirstQuery
.
Thematch
clause can be any other span type query. Theend
controls the maximum end position permitted in a match. - Span
Multi Query - The span_multi query allows you to wrap a
multi term query
(one ofwildcard
,fuzzy
,prefix
,range
orregexp
query) as aspan query
, so it can be nested. - Span
Near Query - 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
span near query maps to Lucene
SpanNearQuery
.
Theclauses
element is a list of one or more other span type queries and theslop
controls the maximum number of intervening unmatched positions permitted. - Span
NotQuery - Removes matches which overlap with another span query or which are within x tokens before
(controlled by the parameter
pre
) or y tokens after (controlled by the parameterpost
) another SpanQuery. The span not query maps to LuceneSpanNotQuery
. - Span
OrQuery - Matches the union of its span clauses. The span or query maps to Lucene
SpanOrQuery
. - Span
Term Query - Matches spans containing a term. The span term query maps to Lucene
SpanTermQuery
. - Span
Within Query - Returns matches which are enclosed inside another span query. The span within query maps to
Lucene
SpanWithinQuery
.
Enums§
- Multi
Term Query - A container enum for supported Elasticsearch query types
- Span
Query - A container enum for supported Elasticsearch query types