elasticsearch/docs/reference/query-dsl/span-multi-term-query.asciidoc
Mayya Sharipova 7de305c4ec
Remove 4096 bool query max limit from docs (#111421)
indices.query.bool.max_clause_count is set automatically and does
not default to 4096 as before. This remove mentions of 4096
from query documentations.

Relates to PR#91811
2024-07-29 15:20:39 -04:00

47 lines
1.4 KiB
Text

[[query-dsl-span-multi-term-query]]
=== Span multi-term query
++++
<titleabbrev>Span multi-term</titleabbrev>
++++
The `span_multi` query allows you to wrap a `multi term query` (one of wildcard,
fuzzy, prefix, range or regexp query) as a `span query`, so
it can be nested. Example:
[source,console]
--------------------------------------------------
GET /_search
{
"query": {
"span_multi": {
"match": {
"prefix": { "user.id": { "value": "ki" } }
}
}
}
}
--------------------------------------------------
A boost can also be associated with the query:
[source,console]
--------------------------------------------------
GET /_search
{
"query": {
"span_multi": {
"match": {
"prefix": { "user.id": { "value": "ki", "boost": 1.08 } }
}
}
}
}
--------------------------------------------------
WARNING: `span_multi` queries will hit too many clauses failure if the number of terms that match the query exceeds the
`indices.query.bool.max_clause_count` <<search-settings,search setting>>.
To avoid an unbounded expansion you can set the <<query-dsl-multi-term-rewrite,
rewrite method>> of the multi term query to `top_terms_*` rewrite. Or, if you use `span_multi` on `prefix` query only,
you can activate the <<index-prefixes,`index_prefixes`>> field option of the `text` field instead. This will
rewrite any prefix query on the field to a single term query that matches the indexed prefix.