Prefix search with missing words

Hello !
I am trying to get a search on index where i want to search something similar to edge ngram where user will start typing beginning of a word and i expect the search result to return the best match. The only problem is seems like edge ngram works only if the search words are next to each other.
What i want is example if the sentence is "quick brown fox jumps over the lazy dog" and if i specify the search as "brow lazy" i am unable to get the results. i don't know which api to use.
Here are the things i researched so far
1>Tried Edge Ngram analyser: If the search has missing words search returns nothing
2>Terms query: This will return even if the words are not in the right sequence and also lot of irrelevant one's
3> match_phrase_prefix : This cannot be used if first few words are half complete

I have spend a lot of time researching this before posting this so any help from the elastic search gurus will be greatly appreciated :slight_smile:

After some trial and error i git this partially working

{ "query": {
"bool": {
"must": [
{"prefix" : { "idxName" : "brow" }},
{"prefix" : { "idxName" : "jum" }},
{"prefix" : { "idxName" : "lazy" }}

	]

}
}
}

'
The problem now is there are some cases where it returns me results where these 3 words are not in the right sequence.
Example if i have
"Jump with lazy animal which is a brown dog " might showup in the search before the one which has the right sequence

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