Skip to content

Match Phrase Query

ignacio-alorre edited this page May 24, 2019 · 14 revisions

The match_phrase query analyzes the text and creates a phrase query out of the analysed text. For example:

GET /_search
{
    "query": {
        "match_phrase" : {
            "message" : "this is a test"
        }
    }
}

A phrase query matches terms up to a configurable slop (which defaults to 0) in any order. Transposed terms have a slop of 2.

The analyser can be set to control which analyzer will perform the analysis process on the text. It defaults to the field explicit mapping definition, or the default search analyser, for example:

GET /_search
{
    "query": {
        "match_phrase" : {
            "message" : {
                "query" : "this is a test",
                "analyzer" : "my_analyzer"
            }
        }
    }
}

Clone this wiki locally