span-within-query.asciidoc 854 B

1234567891011121314151617181920212223242526272829
  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. {
  8. "span_within" : {
  9. "little" : {
  10. "span_term" : { "field1" : "foo" }
  11. },
  12. "big" : {
  13. "span_near" : {
  14. "clauses" : [
  15. { "span_term" : { "field1" : "bar" } },
  16. { "span_term" : { "field1" : "baz" } }
  17. ],
  18. "slop" : 5,
  19. "in_order" : true
  20. }
  21. }
  22. }
  23. }
  24. --------------------------------------------------
  25. The `big` and `little` clauses can be any span type query. Matching
  26. spans from `little` that are enclosed within `big` are returned.