span-near-query.asciidoc 884 B

123456789101112131415161718192021222324252627
  1. [[query-dsl-span-near-query]]
  2. === Span Near Query
  3. Matches spans which are near one another. One can specify _slop_, the
  4. maximum number of intervening unmatched positions, as well as whether
  5. matches are required to be in-order. The span near query maps to Lucene
  6. `SpanNearQuery`. Here is an example:
  7. [source,js]
  8. --------------------------------------------------
  9. {
  10. "span_near" : {
  11. "clauses" : [
  12. { "span_term" : { "field" : "value1" } },
  13. { "span_term" : { "field" : "value2" } },
  14. { "span_term" : { "field" : "value3" } }
  15. ],
  16. "slop" : 12,
  17. "in_order" : false,
  18. "collect_payloads" : false
  19. }
  20. }
  21. --------------------------------------------------
  22. The `clauses` element is a list of one or more other span type queries
  23. and the `slop` controls the maximum number of intervening unmatched
  24. positions permitted.