-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make function scores functions tunable #6955
Comments
Can you use multiple reviews as a temporary workaround for this? I haven't
|
@nik9000 I do not think there is a workaround currently which is unfortunate. I think having the boost factor for each function would make a lot of sense. @s1monw mentioned we could use expressions and expose many of the current functions as expression. That way everyone could write their custom function easily (and add whatever factor they wish) without performance loss. But implementing a boost factor for each function seems like the easiest thing to do right now.
(also cc @honzakral ) |
If we implement the boost_factor thing, I think
If only one function is in there then this weight does not seem to make sense so I would not allow it. |
I like Hmmm, I think you're right. |
I see the use case for single function - a lot of people have simple |
This seems to be an interesting use case until we get another use case. Why not more simply using mathematical expressions to express the different decay functions or a combination them? So I'm definitely +1 on exposing the various functions with Lucene expressions, and on implementing new ones. |
The main reason why we added the decay functions as json with parameters was that not all users like scripting. So, maybe we should have both? Adding the different functions we have now in @honzakral sorry, I was not clear with the single function, I was referring to the case where the score function is not in the function list, like this:
Does not make sense to me to allow it there but I could do it. |
I'm ok with adding a |
Weights can be defined per function like this: ``` "function_score": { "functions": [ { "filter": {}, "FUNCTION": {}, "weight": number } ... ``` If `weight` is given without `FUNCTION` then `weight` behaves like `boost_factor`. This commit deprecates `boost_factor`. The following is valid: ``` POST testidx/_search { "query": { "function_score": { "weight": 2 } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "FUNCTION": {}, "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "filter": {}, "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "filter": {}, "FUNCTION": {}, "weight": 2 }, ... ] } } } ``` The following is not valid: ``` POST testidx/_search { "query": { "function_score": { "weight": 2, "FUNCTION(including boost_factor)": 2 } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "weight": 2, "boost_factor": 2 } ] } } } ```` closes elastic#6955
Weights can be defined per function like this: ``` "function_score": { "functions": [ { "filter": {}, "FUNCTION": {}, "weight": number } ... ``` If `weight` is given without `FUNCTION` then `weight` behaves like `boost_factor`. This commit deprecates `boost_factor`. The following is valid: ``` POST testidx/_search { "query": { "function_score": { "weight": 2 } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "FUNCTION": {}, "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "filter": {}, "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "filter": {}, "FUNCTION": {}, "weight": 2 }, ... ] } } } ``` The following is not valid: ``` POST testidx/_search { "query": { "function_score": { "weight": 2, "FUNCTION(including boost_factor)": 2 } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "weight": 2, "boost_factor": 2 } ] } } } ```` closes #6955 closes #7137
Weights can be defined per function like this: ``` "function_score": { "functions": [ { "filter": {}, "FUNCTION": {}, "weight": number } ... ``` If `weight` is given without `FUNCTION` then `weight` behaves like `boost_factor`. This commit deprecates `boost_factor`. The following is valid: ``` POST testidx/_search { "query": { "function_score": { "weight": 2 } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "FUNCTION": {}, "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "filter": {}, "weight": 2 }, ... ] } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "filter": {}, "FUNCTION": {}, "weight": 2 }, ... ] } } } ``` The following is not valid: ``` POST testidx/_search { "query": { "function_score": { "weight": 2, "FUNCTION(including boost_factor)": 2 } } } POST testidx/_search { "query": { "function_score": { "functions": [ { "weight": 2, "boost_factor": 2 } ] } } } ```` closes #6955 closes #7137
With the
function_score
query, each function can return a range of values: the decay functions return a value between 0 and 1, andfield_value_factor
function can return any value but with (eg) logarithmic functions a typical score is between 0 and 3, therandom_score
function currently returns a very large number (but see #6907), and thescript_score
can return whatever value you calculate.It isn't easy to tune the contribution of each function. If you have two decay clauses: one for location and one for price, you can't easily say that "location is more important than price".
What about making each function accept the
boost_factor
parameter which is multiplied with the output of the function?The text was updated successfully, but these errors were encountered: