I have the following situation:
The simple analyzer processes the text "The brown and green fox are quick" and adds the individual lower case terms to the index.
I want to use the following query phrase against my indices: "quick brown f"
I use the match_phrase_prefix in order to run this search:
{
"query": {
"match_phrase_prefix" : {
"message" : {
"query" : "quick brown f",
"max_expansions" : 10
}
}
}
}
Unfortunately no results are returned since the order of the terms does not match up with the query terms. I will get results back if I use a match query and if I use the complete terms. It seems that match_phrase_prefix is checking the order:
This query works by creating a phrase query out of quick and brown (i.e. the term quick must exist and must be followed by the term brown).
My question:
Is there a way to run a query which does handle incomplete terms and returns results regardless of the order of the terms in the source document? The only option I can currently think of is to manually create a query for each term in the input query (e.g.: quick, brown, f) and combine them using a bool query.