span-within-query.asciidoc 1002 B

1234567891011121314151617181920212223242526272829303132333435
  1. [[query-dsl-span-within-query]]
  2. === Span within query
  3. ++++
  4. <titleabbrev>Span within</titleabbrev>
  5. ++++
  6. Returns matches which are enclosed inside another span query. The span within
  7. query maps to Lucene `SpanWithinQuery`. Here is an example:
  8. [source,console]
  9. --------------------------------------------------
  10. GET /_search
  11. {
  12. "query": {
  13. "span_within" : {
  14. "little" : {
  15. "span_term" : { "field1" : "foo" }
  16. },
  17. "big" : {
  18. "span_near" : {
  19. "clauses" : [
  20. { "span_term" : { "field1" : "bar" } },
  21. { "span_term" : { "field1" : "baz" } }
  22. ],
  23. "slop" : 5,
  24. "in_order" : true
  25. }
  26. }
  27. }
  28. }
  29. }
  30. --------------------------------------------------
  31. The `big` and `little` clauses can be any span type query. Matching
  32. spans from `little` that are enclosed within `big` are returned.