span-near-query.asciidoc 929 B

123456789101112131415161718192021222324252627282930
  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. GET /_search
  10. {
  11. "query": {
  12. "span_near" : {
  13. "clauses" : [
  14. { "span_term" : { "field" : "value1" } },
  15. { "span_term" : { "field" : "value2" } },
  16. { "span_term" : { "field" : "value3" } }
  17. ],
  18. "slop" : 12,
  19. "in_order" : false
  20. }
  21. }
  22. }
  23. --------------------------------------------------
  24. // CONSOLE
  25. The `clauses` element is a list of one or more other span type queries
  26. and the `slop` controls the maximum number of intervening unmatched
  27. positions permitted.