1
0

span-multi-term-query.asciidoc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. [[query-dsl-span-multi-term-query]]
  2. === Span Multi Term Query
  3. The `span_multi` query allows you to wrap a `multi term query` (one of wildcard,
  4. fuzzy, prefix, range or regexp query) as a `span query`, so
  5. it can be nested. Example:
  6. [source,js]
  7. --------------------------------------------------
  8. GET /_search
  9. {
  10. "query": {
  11. "span_multi":{
  12. "match":{
  13. "prefix" : { "user" : { "value" : "ki" } }
  14. }
  15. }
  16. }
  17. }
  18. --------------------------------------------------
  19. // CONSOLE
  20. A boost can also be associated with the query:
  21. [source,js]
  22. --------------------------------------------------
  23. GET /_search
  24. {
  25. "query": {
  26. "span_multi":{
  27. "match":{
  28. "prefix" : { "user" : { "value" : "ki", "boost" : 1.08 } }
  29. }
  30. }
  31. }
  32. }
  33. --------------------------------------------------
  34. // CONSOLE
  35. WARNING: `span_multi` queries will hit too many clauses failure if the number of terms that match the query exceeds the
  36. boolean query limit (defaults to 1024).To avoid an unbounded expansion you can set the <<query-dsl-multi-term-rewrite,
  37. rewrite method>> of the multi term query to `top_terms_*` rewrite. Or, if you use `span_multi` on `prefix` query only,
  38. you can activate the <<index-prefix-config,`index_prefixes`>> field option of the `text` field instead. This will
  39. rewrite any prefix query on the field to a single term query that matches the indexed prefix.