summaryrefslogtreecommitdiff
path: root/docs/reference/query-dsl/match-phrase-prefix-query.asciidoc
blob: 7e5a75dd171b9f956f0bfebc5ce742b4f525c193 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[[query-dsl-match-query-phrase-prefix]]
=== Match Phrase Prefix Query

The `match_phrase_prefix` is the same as `match_phrase`, except that it
allows for prefix matches on the last term in the text. For example:

[source,js]
--------------------------------------------------
{
    "match_phrase_prefix" : {
        "message" : "this is a test"
    }
}
--------------------------------------------------

It accepts the same parameters as the phrase type. In addition, it also
accepts a `max_expansions` parameter that can control to how many
prefixes the last term will be expanded. It is highly recommended to set
it to an acceptable value to control the execution time of the query.
For example:

[source,js]
--------------------------------------------------
{
    "match_phrase_prefix" : {
        "message" : {
            "query" : "this is a test",
            "max_expansions" : 10
        }
    }
}
--------------------------------------------------