Elasticsearch: “function_score” with “boost_mode”:“replace” ignores function score

后端 未结 1 1786
谎友^
谎友^ 2021-01-17 04:53

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

相关标签:
1条回答
  • 2021-01-17 05:00

    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

    0 讨论(0)
提交回复
热议问题