I have the following setup:
Every document in ES has a field of type string, that contains a list
basket : ["yuca", "potato"]
and a field of type long called price
I'm adjusting the score of my search results based on the difference
the price field and the price I search for.
I use CustomScoreQuery and I pass this mvel script to it:
I am using a Boolean filter to get a partial match on the basket
using pyes (0.16.0), so under the hood the filter looks like this:
Here's what I'm trying to do:
I want to be able to adjust the score when I get a partial match on
In this example I asked for 'yuca' and 'yam' and the result contains
and 'potato' (so only 'yuca' is a match). I want to penalise the score
one point for each missed term.
In this case the price contribution to the score is 6 and the basket
should be 1, so the overall score for this should be 5.
I prefer to handle this logic in the script that I pass to
but I'm open to other solutions as well.