2013-08-29 07:24:34 +08:00
|
|
|
[[query-dsl-span-multi-term-query]]
|
2015-06-04 07:59:22 +08:00
|
|
|
=== Span Multi Term Query
|
2013-08-29 07:24:34 +08:00
|
|
|
|
2015-02-06 04:23:52 +08:00
|
|
|
The `span_multi` query allows you to wrap a `multi term query` (one of wildcard,
|
2015-02-25 02:44:51 +08:00
|
|
|
fuzzy, prefix, term, range or regexp query) as a `span query`, so
|
2013-08-29 07:24:34 +08:00
|
|
|
it can be nested. Example:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2016-05-24 17:58:43 +08:00
|
|
|
GET /_search
|
2013-08-29 07:24:34 +08:00
|
|
|
{
|
2016-05-24 17:58:43 +08:00
|
|
|
"query": {
|
|
|
|
"span_multi":{
|
|
|
|
"match":{
|
|
|
|
"prefix" : { "user" : { "value" : "ki" } }
|
|
|
|
}
|
2013-08-29 07:24:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2016-05-24 17:58:43 +08:00
|
|
|
// CONSOLE
|
2013-08-29 07:24:34 +08:00
|
|
|
|
|
|
|
A boost can also be associated with the query:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2016-05-24 17:58:43 +08:00
|
|
|
GET /_search
|
2013-08-29 07:24:34 +08:00
|
|
|
{
|
2016-05-24 17:58:43 +08:00
|
|
|
"query": {
|
|
|
|
"span_multi":{
|
|
|
|
"match":{
|
|
|
|
"prefix" : { "user" : { "value" : "ki", "boost" : 1.08 } }
|
|
|
|
}
|
2013-08-29 07:24:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2016-05-24 17:58:43 +08:00
|
|
|
// CONSOLE
|