# Function Score Question

**URL:** <https://discuss.elastic.co/t/function-score-question/62098>\
**Category:** Elasticsearch\
**Created:** [October 3, 2016, 6:12pm UTC](https://discuss.elastic.co/t/function-score-question/62098 "2016-10-03T18:12:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Behzat\_Civici](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/behzat_civici/32/12275_2.png) [@Behzat\_Civici](https://discuss.elastic.co/u/Behzat_Civici)\
**Post date:** [October 3, 2016, 6:12pm UTC](https://discuss.elastic.co/t/function-score-question/62098/1 "2016-10-03T18:12:34Z")

</div>

Following is my function\_score query. I want to give additional score to documents where the product quality is better.

But \_score in the search response is always 0. What am I missing? Thx.

When I remove bool query and replace it with just a term filter, the score is non zero. I am guessing it is about the query bool but can not figure out why.

Elasticsearch version is 2.4

```
{
  "from": 0,
  "size": 20,
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "filter": [
            {
              "bool": {
                "should": {
                  "terms": {
                    "categories.category1Id": [
                      63
                    ]
                  }
                }
              }
            }
          ]
        }
      },
      "functions": [
        {
          "gauss": {
            "updatedDate": {
              "origin": "2016-10-03 05:10:18",
              "scale": "0.5h",
              "decay": 0.1,
              "offset": "1h"
            }
          }
        },
        {
          "filter": {
            "term": {
              "productQuality": "EXCELLENT"
            }
          },
          "weight": 7
        },
        {
          "filter": {
            "term": {
              "productQuality": "HIGH"
            }
          },
          "weight": 5
        },
        {
          "filter": {
            "term": {
              "productQuality": "MEDIUM"
            }
          },
          "weight": 3
        },
        {
          "filter": {
            "term": {
              "productQuality": "LOW"
            }
          },
          "weight": 1
        }
      ],
      "score_mode": "sum"
    }
  }
}
```

---

<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 5, 2017, 10:15pm UTC](https://discuss.elastic.co/t/function-score-question/62098/2 "2017-07-05T22:15:21Z")

</div>


