Match Phrase Prefix Query
More info about match phrase prefix query is in the official elasticsearch docs
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
Simple example
{
"query": {
"match_phrase_prefix" : {
"message" : {
"query" : "quick brown f",
"max_expansions" : 10
}
}
}
}
In DSL:
$query = new MatchPhrasePrefixQuery('message', 'quick brown f');
$query->addParameter('max_expansions', 10);
$search = new Search();
$search->addQuery($query);
$queryArray = $search->toArray();