I am trying to modify scores from normal query with different functions defined in function_score.
To find out what scores calculated by my functions are, I specify
In your sample, the function doesn't match any docs: function score, no filter match,
. Also, from the documentation when replace is being used, the following happens: only function score is used, the query score is ignored
. So, the situation is like this: the filter doesn't match - so no scoring is computed - and replace
will make the query score to be ignored and to use the score from the filter (which doesn't exist as it didn't match).
And when the function doesn't match, the default value of the function is 1
. You can check this with "boost_mode": "sum"
. My opinion is that this is the reason why you see a score of 1
.
Regarding the avg
behavior, this doesn't look ok to me and, most likely, it's a bug. I reported it here: https://github.com/elastic/elasticsearch/issues/13732