I am having a field named title which is having values as below
- apple iphone 6s
- apple iphone 6
- apple iphone 6s plus
- apple iphone
- apple iphone 5s
So if user searches for
apple iphone 6
Then it should come in the order as
2 > 1 > 3 > 4 > 5
. and if user searches for
apple iphone 6s
It should come in order as
1 > 3 > 2 > 4 > 5.
How can this be done using elasticsearch.
I have used multi_search and all. But no help.
The order should be exact match first, then prefix. then phrases then field containing all 3 terms and then field containing 2 terms and then field containing 1 terms and so on.
Thank you for your help.