span-queries.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. [[span-queries]]
  2. == Span queries
  3. Span queries are low-level positional queries which provide expert control
  4. over the order and proximity of the specified terms. These are typically used
  5. to implement very specific queries on legal documents or patents.
  6. It is only allowed to set boost on an outer span query. Compound span queries,
  7. like span_near, only use the list of matching spans of inner span queries in
  8. order to find their own spans, which they then use to produce a score. Scores
  9. are never computed on inner span queries, which is the reason why boosts are not
  10. allowed: they only influence the way scores are computed, not spans.
  11. Span queries cannot be mixed with non-span queries (with the exception of the `span_multi` query).
  12. The queries in this group are:
  13. <<query-dsl-span-containing-query,`span_containing` query>>::
  14. Accepts a list of span queries, but only returns those spans which also match a second span query.
  15. <<query-dsl-span-field-masking-query,`field_masking_span` query>>::
  16. Allows queries like `span-near` or `span-or` across different fields.
  17. <<query-dsl-span-first-query,`span_first` query>>::
  18. Accepts another span query whose matches must appear within the first N
  19. positions of the field.
  20. <<query-dsl-span-multi-term-query,`span_multi` query>>::
  21. Wraps a <<query-dsl-term-query,`term`>>, <<query-dsl-range-query,`range`>>,
  22. <<query-dsl-prefix-query,`prefix`>>, <<query-dsl-wildcard-query,`wildcard`>>,
  23. <<query-dsl-regexp-query,`regexp`>>, or <<query-dsl-fuzzy-query,`fuzzy`>> query.
  24. <<query-dsl-span-near-query,`span_near` query>>::
  25. Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order.
  26. <<query-dsl-span-not-query,`span_not` query>>::
  27. Wraps another span query, and excludes any documents which match that query.
  28. <<query-dsl-span-or-query,`span_or` query>>::
  29. Combines multiple span queries -- returns documents which match any of the
  30. specified queries.
  31. <<query-dsl-span-term-query,`span_term` query>>::
  32. The equivalent of the <<query-dsl-term-query,`term` query>> but for use with
  33. other span queries.
  34. <<query-dsl-span-within-query,`span_within` query>>::
  35. The result from a single span query is returned as long is its span falls
  36. within the spans returned by a list of other span queries.
  37. include::span-containing-query.asciidoc[]
  38. include::span-field-masking-query.asciidoc[]
  39. include::span-first-query.asciidoc[]
  40. include::span-multi-term-query.asciidoc[]
  41. include::span-near-query.asciidoc[]
  42. include::span-not-query.asciidoc[]
  43. include::span-or-query.asciidoc[]
  44. include::span-term-query.asciidoc[]
  45. include::span-within-query.asciidoc[]