mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-04 09:59:16 +00:00
Expose new span queries from https://issues.apache.org/jira/browse/LUCENE-6083 Within returns matches from 'little' that are enclosed inside of a match from 'big'. Containing returns matches from 'big' that enclose matches from 'little'.
30 lines
854 B
Plaintext
30 lines
854 B
Plaintext
[[query-dsl-span-within-query]]
|
|
=== Span Within Query
|
|
|
|
Returns matches which are enclosed inside another span query. The span within
|
|
query maps to Lucene `SpanWithinQuery`. Here is an example:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
{
|
|
"span_within" : {
|
|
"little" : {
|
|
"span_term" : { "field1" : "foo" }
|
|
},
|
|
"big" : {
|
|
"span_near" : {
|
|
"clauses" : [
|
|
{ "span_term" : { "field1" : "bar" } },
|
|
{ "span_term" : { "field1" : "baz" } }
|
|
],
|
|
"slop" : 5,
|
|
"in_order" : true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
|
|
The `big` and `little` clauses can be any span type query. Matching
|
|
spans from `little` that are enclosed within `big` are returned.
|