I'm using function score with score_mode avg and boost_mode replace.
And according to documentation I'm expecting the query function score to be overriden by the function score filters.
This works as expected for the sum and multiply, but not for avg (I'm aware that the average in function score is a weighted average)
When I apply this function_score all the documents get a score of 1.
How can this happen?
Hi @dadoonet Thank you for the try here for helping me out!
I think I figured it out. the whys I don't know exactly.
But when one of the filters don't match it is doesn't seem to be took into acount in the formula weighted average formula.
More over is that if no filter is matched the score is defined between the min value of 1, and a very large value.
As a result, all if an element match 2 filters it will get 1, because the other 1 filter does not enter in the formula, an element with 1 match filter gets 1 score because the other 2 unmatched filters are also not took into acount. and the 100% unmatched filter documents, get 1 because it is the min between 1, and a very large number. So it really looks like no matter the case we will get always 1 score, when we use score_mode avg and boost_mode replace. I don't know if it happens for boost_mode too but it's out of the scope of this question.
I obtain this information by exploring explain API.
Have a great day, and take care about the corona virus!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.