mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
In the upcoming Lucene 9 release, `indices.query.bool.max_clause_count` is going to apply to the entire query tree rather than per `bool` query. In order to avoid breaks, the limit has been bumped from 1024 to 4096. The semantics will effectively change when we upgrade to Lucene 9, this PR is only about agreeing on a migration strategy and documenting this change. To avoid further breaks, I am leaning towards keeping the current setting name even though it contains `bool`. I believe that it still makes sense given that `bool` queries are typically the main contributors to high numbers of clauses. Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
46 lines
1.4 KiB
Text
46 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
|
|
boolean query limit (defaults to 4096).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.
|
|
|