span-within-query.asciidoc 959 B

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