I want to implement autocomplete with elasticsearch and I'm unable to do it. I want something like this question here. I tried the suggested answers but in vain. I want to have something like the following :
I have used complete suggester to handle such scenarios .Since order of search is important .
A simple example would be having these documents indexed using standard analyzer:
A :Source B :Destination
1. Bus from Alpha to Beta
2. Morning Bus from Alpha to Beta
3. Bus Fare from Beta to Alpha
4. Cheapest Bus Fare from Beta via Cita to Alpha
I could query for "Alp" and this would return me all documents, including the third and fourth one.I want to retrieve only documents 1 and 2 .If I query "Bet"or "Beta" only documents 3 and documents 4 should return.Slop is not specific to 1 or 2 it can be anything .
Please suggest the index settings properties for this and share the code
What if I wanted to only retrieve the documents which have the terms in this specific order? Can I form a query that would do that for me?
Considering it is possible for phrases by simply quoting the text: "Bus Alp" ,"Bus Alph"(retrieve 1st and 2nd docs) it feels to me like there should be a way of preserving the order for multiple terms that aren't adjacent. I have used complete suggester .But it doesnot seem to solve all the use cases . Please suggest ?