Phrase Query

A phrase is surrounded with double quotes ("") and allows searching for a specific exact phrase and returns only matches where all terms appear in the document in the correct order, giving a weight of the sum of each term. For example:

  • Documents which match A followed by B followed by C gives a weight of A+B+C

Note
When searching for phrases, stop words do not apply.

Caution
Hyphenated words are also treated as phrases, as are cases such as filenames and email addresses (e.g. /etc/passwd or president@whitehouse.gov)

Example

In the following example, we will retrieve documents with the exact phrase, including the stop words these, are, few, and far and between.

SEARCH /bank/
{
  "_query": {
    "personality": "\"these days are few and far between\""
  }
}
SEARCH /bank/
{
  "_query": {
    "personality": {
      "_phrase": "these days are few and far between"
    }
  }
}