I'm scoring es query with three functions
:
{ "query": { "function_score": { "query": { "bool": { ... } } } }, "score_mode": "multiply", "boost_mode": "replace", "functions": [ { f1 }, { f2 }, { f3 } ] }
so the score would be: f1(doc) * f2(doc) * f3(doc)
.
But what I want is f1(doc) * f2(doc) + f3(doc)
, any solutions?
2 Answers
Answers 1
This might work, i.e. we multiply the scores of functions f1 and f2 together and then we add that score to the query score which is another function_score
query just for f3.
{ "query": { "function_score": { "query": { "function_score": { "query": { "match_all": {}}, "functions": [ { "f3": {...} } ] } }, "functions": [ { "f1": {...} }, { "f2": {...} } ], "score_mode": "multiply", "boost_mode": "sum" } } }
Answers 2
there is a sum option for the score mode
"score_mode": "sum",
this should allow you to sum the scores.
see f.e. https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html
0 comments:
Post a Comment