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 A to B
2. Morning Bus from A to B
3. Bus Fare from B to A
4. Cheapest Bus Fare from B via C to A
I could query for "A" and this would return me all documents, including the third one.I want to retrieve only documents 1 and 2 .If I query "B" 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 A" (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 ?