Earlier I implemented a search as you type using the prefix query but then it has got a lot of issues due to stemmed fields in my index :-
Suppose my index name is jaipur
and it contains a field title
which is analyzed based on the language analyzer.
So if the index is for english
language, then below stemmed words would be stored like below
original word stemmed form
nutritional nutrit
suggestions suggest
recommendation recommend
Now using prefix query, when I search till nutrit
or suggest
it gives me the result but as soon as type a next character after the stemmed form
like nutriti
or suggestio
my results go away as these tokens are not present in my inverted index and prefix queries are not analyzed.
I read a lot of elasticsearch documentation and it seems only index time solution would solve my issue but the downside of it is that it requires re-indexing the whole data and I have more than billion documents in my index, we wanted to avoid re-indexing that was also one of the reason, we earlier choosed prefix based solution .
Could anybody suggest is there any alternatives? Let me know if more information required.
Note :- I am using ES 1.7.4 version.