I’m using elastic to search terms that were detected in a sentence of free text against an inner DB that was indexed.
I have a problem when my query appears in the DB with some tokens repetition.
For example: I search the term “computer” while the DB includes 2 different documents:
- “computer, dell computer”
In this case the first doc (“computer, dell computer”) will be returned because it includes more matches, but the second doc (“computer”) is a more appropriate response.
To clarify, there are cases when the repetition appears also in the query so I can’t just remove duplicates.
I found this solution, but since I’m searching for a free text I want to combine analyzers and fuzziness too.
Is there an option to make sure that the text in the relevant field is contained in my query (taking into account fuzziness) or to change scoring so elastic prefer match on a longer percentage of the doc over a longer match?
Here is my query: