wildcard-query.asciidoc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. [[query-dsl-wildcard-query]]
  2. === Wildcard Query
  3. Matches documents that have fields matching a wildcard expression (*not
  4. analyzed*). Supported wildcards are `*`, which matches any character
  5. sequence (including the empty one), and `?`, which matches any single
  6. character. Note this query can be slow, as it needs to iterate over many
  7. terms. In order to prevent extremely slow wildcard queries, a wildcard
  8. term should not start with one of the wildcards `*` or `?`. The wildcard
  9. query maps to Lucene `WildcardQuery`.
  10. [source,js]
  11. --------------------------------------------------
  12. GET /_search
  13. {
  14. "query": {
  15. "wildcard" : { "user" : "ki*y" }
  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. "wildcard" : { "user" : { "value" : "ki*y", "boost" : 2.0 } }
  27. }
  28. }
  29. --------------------------------------------------
  30. // CONSOLE
  31. Or :
  32. [source,js]
  33. --------------------------------------------------
  34. GET /_search
  35. {
  36. "query": {
  37. "wildcard" : { "user" : { "wildcard" : "ki*y", "boost" : 2.0 } }
  38. }
  39. }
  40. --------------------------------------------------
  41. // CONSOLE
  42. This multi term query allows to control how it gets rewritten using the
  43. <<query-dsl-multi-term-rewrite,rewrite>>
  44. parameter.