原文地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/query-dsl-span-multi-term-query.html, 原文档版权归 www.elastic.co 所有
IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Span multi-term queryedit
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:
GET /_search { "query": { "span_multi":{ "match":{ "prefix" : { "user" : { "value" : "ki" } } } } } }
A boost can also be associated with the query:
GET /_search { "query": { "span_multi":{ "match":{ "prefix" : { "user" : { "value" : "ki", "boost" : 1.08 } } } } } }
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 1024).To avoid an unbounded expansion you can set the 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
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.