elasticsearch/docs/reference/query-dsl/span-within-query.asciidoc
Mayya Sharipova d6c53e03d2
Improve span queries documentation (#103490)
Improvement includes:
1. Remove reference to Lucene queries (this information is not necessary
for Elastic users, and can be outdated)
2. For `span_field_masking` include a node to use
"require_field_match" : false parameter for highlighters to work.

Closes #101804
2023-12-19 14:51:19 -05:00

35 lines
808 B
Text

[[query-dsl-span-within-query]]
=== Span within query
++++
<titleabbrev>Span within</titleabbrev>
++++
Returns matches which are enclosed inside another span query.
Here is an example:
[source,console]
--------------------------------------------------
GET /_search
{
"query": {
"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.