span-near-query.asciidoc 900 B

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