NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Span queries
editSpan queries
editSpan 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.
Setting boost on inner span queries is deprecated. 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 their boosts
don’t make sense.
Span queries cannot be mixed with non-span queries (with the exception of the span_multi query).
The queries in this group are:
-
span_termquery -
The equivalent of the
termquery but for use with other span queries. -
span_multiquery -
Wraps a
term,range,prefix,wildcard,regexp, orfuzzyquery. -
span_firstquery - Accepts another span query whose matches must appear within the first N positions of the field.
-
span_nearquery - Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order.
-
span_orquery - Combines multiple span queries — returns documents which match any of the specified queries.
-
span_notquery - Wraps another span query, and excludes any documents which match that query.
-
span_containingquery - Accepts a list of span queries, but only returns those spans which also match a second span query.
-
span_withinquery - The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries.
-
field_masking_spanquery -
Allows queries like
span-nearorspan-oracross different fields.