match-phrase-query.asciidoc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. [[query-dsl-match-query-phrase]]
  2. === Match Phrase Query
  3. The `match_phrase` query analyzes the text and creates a `phrase` query
  4. out of the analyzed text. For example:
  5. [source,js]
  6. --------------------------------------------------
  7. GET /_search
  8. {
  9. "query": {
  10. "match_phrase" : {
  11. "message" : "this is a test"
  12. }
  13. }
  14. }
  15. --------------------------------------------------
  16. // CONSOLE
  17. A phrase query matches terms up to a configurable `slop`
  18. (which defaults to 0) in any order. Transposed terms have a slop of 2.
  19. The `analyzer` can be set to control which analyzer will perform the
  20. analysis process on the text. It defaults to the field explicit mapping
  21. definition, or the default search analyzer, for example:
  22. [source,js]
  23. --------------------------------------------------
  24. GET /_search
  25. {
  26. "query": {
  27. "match_phrase" : {
  28. "message" : {
  29. "query" : "this is a test",
  30. "analyzer" : "my_analyzer"
  31. }
  32. }
  33. }
  34. }
  35. --------------------------------------------------
  36. // CONSOLE