# Elasticsearch script score and decay function scores do not multiply

**URL:** <https://discuss.elastic.co/t/elasticsearch-script-score-and-decay-function-scores-do-not-multiply/21269>\
**Category:** Elasticsearch\
**Created:** [December 16, 2014, 8:24am UTC](https://discuss.elastic.co/t/elasticsearch-script-score-and-decay-function-scores-do-not-multiply/21269 "2014-12-16T08:24:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![valerij\_vasilcenko](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@valerij\_vasilcenko](https://discuss.elastic.co/u/valerij_vasilcenko)\
**Post date:** [December 16, 2014, 8:24am UTC](https://discuss.elastic.co/t/elasticsearch-script-score-and-decay-function-scores-do-not-multiply/21269/1 "2014-12-16T08:24:50Z")

</div>

"query": {  
"function\_score": {  
"filter" : {  
"bool" : {  
"must" : [  
{ "terms" : { "content" : "test"} }  
]  
}

```
    },
    "functions": [{
        "exp": {
            "date": {
                  "origin": "now",
                  "scale": "1d",
                  "decay" : 0.05
            }
        },
        "script_score": {
            "script": "_score * 10",
            "lang":"groovy"
        }   
    }],
    "score_mode": "multiply"
}

```

}}

"functions" scores do not multiply. Score is calculated only using last  
function. If I swap places "exp" with "script\_score", "exp" score will be  
shown. What is the problem? Notice: "script\_score" is just a dummy function.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/efcf20a5-b2f5-451d-82b5-220c3fb41216%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/efcf20a5-b2f5-451d-82b5-220c3fb41216%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![valerij\_vasilcenko](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@valerij\_vasilcenko](https://discuss.elastic.co/u/valerij_vasilcenko)\
**Post date:** [December 16, 2014, 8:40am UTC](https://discuss.elastic.co/t/elasticsearch-script-score-and-decay-function-scores-do-not-multiply/21269/2 "2014-12-16T08:40:27Z")

</div>

There was on error in a query. It should be:  
{"exp": {  
"date": {  
"origin": "now",  
"scale": "1d",  
"decay" : 0.05  
}  
}},  
{"script\_score": {  
"script": "\_score \* 10",  
"lang":"groovy"  
}}

On Tuesday, December 16, 2014 10:24:50 AM UTC+2,  
[valerij.v...@googlemail.com](mailto:valerij.v...@googlemail.com) wrote:

> "query": {  
> "function\_score": {  
> "filter" : {  
> "bool" : {  
> "must" : [  
> { "terms" : { "content" : "test"} }  
> ]  
> }
> 
> ```
> },
> "functions": [{
> "exp": {
> "date": {
> "origin": "now",
> "scale": "1d",
> "decay" : 0.05
> }
> },
> "script_score": {
> "script": "_score * 10",
> "lang":"groovy"
> }   
> }],
> "score_mode": "multiply"
> }
> 
> ```
> 
> }}
> 
> "functions" scores do not multiply. Score is calculated only using last  
> function. If I swap places "exp" with "script\_score", "exp" score will be  
> shown. What is the problem? Notice: "script\_score" is just a dummy function.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f0ac8e61-4e44-4cd8-a470-0885357dacf9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f0ac8e61-4e44-4cd8-a470-0885357dacf9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:43am UTC](https://discuss.elastic.co/t/elasticsearch-script-score-and-decay-function-scores-do-not-multiply/21269/3 "2017-07-06T00:43:31Z")

</div>


