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

  • Returns matches which enclose another span query. The span containing query maps to Lucene SpanContainingQuery.
    The big and little clauses can be any span type query. Matching spans from big that contain matches from little are returned.
  • 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
  • Matches spans near the beginning of a field. The span first query maps to Lucene SpanFirstQuery.
    The match clause can be any other span type query. The end controls the maximum end position permitted in a match.
  • The span_multi query allows you to wrap a multi term query (one of wildcard, fuzzy, prefix, range or regexp query) as a span query, so it can be nested.
  • 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.
    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 or which are within x tokens before (controlled by the parameter pre) or y tokens after (controlled by the parameter post) another SpanQuery. The span not query maps to Lucene SpanNotQuery.
  • Matches the union of its span clauses. The span or query maps to Lucene SpanOrQuery.
  • Matches spans containing a term. The span term query maps to Lucene SpanTermQuery.
  • Returns matches which are enclosed inside another span query. The span within query maps to Lucene SpanWithinQuery.

Enums

  • A container enum for supported Elasticsearch query types
  • A container enum for supported Elasticsearch query types