Hi,
I use the following query, in this one I have 2 functions:
- distance_feature : compute a score based on distance
- random_score : compute a value between 0 and 1
The final score = distance_feature * random_score
The problem is that I have such situation:
distance_feature = 0.9
random_score = 0.001
=> score = 0.0009
and so, something that is near of the origin point, will be put at the end of the results !
The random_score 'absord' the distance_feature !
I'm looking for a way to compute something like this, in order to moderate its impact:
distance_feature + (distance_feature * 0.2) * random_score
The result will be something that vary between 100% and 120%:
0.9 + (0.9 * 0.2) * 0.0009 = 0.9009
PS: noticed that I wish to use it with pagination (So, using script_score does seems possible without having some duplicates).
Here is my query, for example:
GET /_search
{
"explain": true,
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"distance_feature": {
"field": "geoLocations",
"pivot": "20km",
"origin": [-71.3,41.15]
}
}
]
}
},
"random_score": {},
"boost": "1",
"boost_mode": "multiply"
}
}
}