original question: https://stackoverflow.com/questions/50717204/elasticsearch-score-mode-sum-dont-return-expected-resutls
I have a query with two decay functions ( ES 2.4.4 ), I am using "score_mode" : "sum" to sum the decay functions scores + score from the query term. for the test I am using "boost_mode" : "replace" to prevent any other scores (from the query) to affect my score ( I want to test the decay functions ).
these is my decay functions:
"function_score": {
"boost_mode" : "replace",
"score_mode" : "sum",
"functions": [
{
"gauss": {
"date": {
"scale": "10d",
"offset": "15d",
"decay": 0.9
}
}, "weight" : 400
},
{
"gauss": {
"priority": {
"origin": "5000",
"scale": "2000",
"decay": 0.9
}
}, "weight" : 20
}
]
my results include 2 articles with different dates (2017-08-28 , 2009-05-08) with the same priority (1000) and the same score! (13.122) how it can be? why doesn't the 2017-08-28 get better score? so I tried to explain the query.
for 2017-08-28:
"value": 13.122,
"description": "function score, score mode [sum]",
"details": [
{
"value": 7.897688e-31,
"description": "function score, product of:",
"details": [
{
"value": 1,
"description": "match filter: *:*",
"details": [
]
},
{ }
]
},
{
"value": 13.122,
"description": "function score, product of:",
"details": [
{
"value": 1,
"description": "match filter: *:*",
"details": [
]
},
{
"value": 13.122,
"description": "product of:",
"details": [
I have a query with two decay functions ( ES 2.4.4 ), I am using "score_mode" : "sum" to sum the decay functions scores + score from the query term. for the test I am using "boost_mode" : "replace" to prevent any other scores (from the query) to affect my score ( I want to test the decay functions ).
these is my decay functions:
"function_score": {
"boost_mode" : "replace",
"score_mode" : "sum",
"functions": [
{
"gauss": {
"date": {
"scale": "10d",
"offset": "15d",
"decay": 0.9
}
}, "weight" : 400
},
{
"gauss": {
"priority": {
"origin": "5000",
"scale": "2000",
"decay": 0.9
}
}, "weight" : 20
}
]
my results include 2 articles with different dates (2017-08-28 , 2009-05-08) with the same priority (1000) and the same score! (13.122) how it can be? why doesn't the 2017-08-28 get better score? so I tried to explain the query.
for 2017-08-28:
`"value": 13.122,
"description": "function score, score mode [sum]",
"details": [
{
"value": 7.897688e-31,
"description": "function score, product of:",
"details": [
{
"value": 1,
"description": "match filter: *:*",
"details": [
]
},
{ }
]
},
{
"value": 13.122,
"description": "function score, product of:",
"details": [
{
"value": 1,
"description": "match filter: *:*",
"details": [
]
},
{
"value": 13.122,
"description": "product of:",
"details": [`
I don't understand why the score is 13.122 instead of 13.122 + 7.897. is there a bug with "score_mode" : "sum" or is there something I don't understand? the other article from 2009-05-08 has a score of 13.122 for the priority and 0 for the date.
note: I must use "score_mode" : "sum" because I want to get top 10 results from each type, and for some of my types date is not relevant so I use an old date whose score is 0, when score mode set to multiply ( default ) all my scores for this type return as 0 because of multiplication.