wildcard-query.asciidoc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. {
  13. "wildcard" : { "user" : "ki*y" }
  14. }
  15. --------------------------------------------------
  16. A boost can also be associated with the query:
  17. [source,js]
  18. --------------------------------------------------
  19. {
  20. "wildcard" : { "user" : { "value" : "ki*y", "boost" : 2.0 } }
  21. }
  22. --------------------------------------------------
  23. Or :
  24. [source,js]
  25. --------------------------------------------------
  26. {
  27. "wildcard" : { "user" : { "wildcard" : "ki*y", "boost" : 2.0 } }
  28. }
  29. --------------------------------------------------
  30. This multi term query allows to control how it gets rewritten using the
  31. <<query-dsl-multi-term-rewrite,rewrite>>
  32. parameter.