match-phrase-prefix-query.asciidoc 960 B

1234567891011121314151617181920212223242526272829303132
  1. [[query-dsl-match-query-phrase-prefix]]
  2. === Match Phrase Prefix Query
  3. The `match_phrase_prefix` is the same as `match_phrase`, except that it
  4. allows for prefix matches on the last term in the text. For example:
  5. [source,js]
  6. --------------------------------------------------
  7. {
  8. "match_phrase_prefix" : {
  9. "message" : "this is a test"
  10. }
  11. }
  12. --------------------------------------------------
  13. It accepts the same parameters as the phrase type. In addition, it also
  14. accepts a `max_expansions` parameter that can control to how many
  15. prefixes the last term will be expanded. It is highly recommended to set
  16. it to an acceptable value to control the execution time of the query.
  17. For example:
  18. [source,js]
  19. --------------------------------------------------
  20. {
  21. "match_phrase_prefix" : {
  22. "message" : {
  23. "query" : "this is a test",
  24. "max_expansions" : 10
  25. }
  26. }
  27. }
  28. --------------------------------------------------