Exact string match


I'm new to elastic search but I'm trying to best. I've been trying to solve an issue lately but without success.
I'm trying to boost results that have exact match of the search term. Let me explain.

Simple scenario:

Let say I have 2 items. Each has a name that is being searched.
1 - "name":"A lot of pain",
2 - "name" : "Not very painful"

Lets say I search with term "pain"
Currently the field "name" is analyzed by custom analyzer that is returning both items.

What I want to achieve is to boost item 1 as it contains exact match of the search term.
While I still want item 2 to be return as its still contains the search term but to be on lower score as its not exact match.

Hope it makes sense,
best regards

You can find some ideas here:

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