[6.1][_all][matchPhraseQuery] How to search _all in java?

in 5.x versions , i write code as :
QueryBuilders.matchPhraseQuery("_all", string);

but when I update to 6.1 ,this does not work .
In 6.1 ,this works fine

get /index/_search
{
"query" : {
"query_string" : {
"query" : "Yes , I am",
"type" : "phrase"
}
}
}

but I don't know how to use in java . (elasticsearch-6.1.jar)
neighter the function Querybuilders.queryStringQuery() nor Querybuilders.matchPhraseQuery() can match my request.
Help!

oh,I read the source code and finally find a way.

QueryStringQueryBuilder queryStringQuery = QueryBuilders.queryStringQuery(word);
queryStringQuery.type(MultiMatchQueryBuilder.Type.PHRASE);

this can replace the old code :" matchPhraseQuery("_all", string); "

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.