# How to modify default \_score to 0?

**URL:** https://discuss.elastic.co/t/how-to-modify-default-score-to-0/160111
**Category:** Elasticsearch
**Created:** [December 10, 2018, 7:47am UTC](https://discuss.elastic.co/t/how-to-modify-default-score-to-0/160111 "2018-12-10T07:47:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![920663d69ffd7d4add49](https://avatars.discourse-cdn.com/v4/letter/9/f08c70/32.png) [@920663d69ffd7d4add49](https://discuss.elastic.co/u/920663d69ffd7d4add49)
#### Post date: [December 10, 2018, 7:47am UTC](https://discuss.elastic.co/t/how-to-modify-default-score-to-0/160111/1 "2018-12-10T07:47:36Z")

</div>

I tried function\_score query with some filters whose weights are less than 1. However, the max\_score of the result is 1 by default (documents matches none of the filters are scored 1 by default).

---

<div class="post-metadata">

### Author: ![920663d69ffd7d4add49](https://avatars.discourse-cdn.com/v4/letter/9/f08c70/32.png) [@920663d69ffd7d4add49](https://discuss.elastic.co/u/920663d69ffd7d4add49)
#### Post date: [December 10, 2018, 8:22am UTC](https://discuss.elastic.co/t/how-to-modify-default-score-to-0/160111/2 "2018-12-10T08:22:35Z")

</div>

Here is my simplified query:

```
{
    "size": 5,
    "explain": true,
    "_source":["sku"],
    "query": {
        "function_score": {
            "query": {
                "bool": {
                    "should": [
                        {
                            "match": {
                                "cid3": "1591"
                            }
                        }
                    ]
                }
            },
            "functions": [
                {
                    "filter": {
                        "match": {
                            "brand_id": "27776"
                        }
                    },
                    "weight": 0.58
                }
            ],
            "score_mode": "sum",
            "boost_mode": "replace"
        }
    }
}

```

I enabled the explain switch then the result is:

```
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 352,
    "max_score" : 1.0, ## what I want is 0.58
    "hits" : [
      {
        "_shard" : "[flashsale][0]",
        "_node" : "Z0W0-rIfS2qkx3cpsOYhwA",
        "_index" : "flashsale",
        "_type" : "_doc",
        "_id" : "5030920",
        "_score" : 1.0,
        "_source" : {
          "sku" : "5030920"
        },
        "_explanation" : {
          "value" : 1.0,
          "description" : "min of:",
          "details" : [
            {
              "value" : 1.0, ## And I wonder if this default value could be reset to 0
              "description" : "No function matched",
              "details" : []
            },
            {
              "value" : 3.4028235E38,
              "description" : "maxBoost",
              "details" : []
            }
          ]
        }
      }
    ]
  }
}
```

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 10, 2018, 8:29am UTC](https://discuss.elastic.co/t/how-to-modify-default-score-to-0/160111/3 "2018-12-10T08:29:47Z")

</div>

Please don't post images of text as they are hardly readable and not searchable.

Instead paste the text and format it with `</>` icon. Check the preview window.

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

### Author: ![920663d69ffd7d4add49](https://avatars.discourse-cdn.com/v4/letter/9/f08c70/32.png) [@920663d69ffd7d4add49](https://discuss.elastic.co/u/920663d69ffd7d4add49)
#### Post date: [December 10, 2018, 8:57am UTC](https://discuss.elastic.co/t/how-to-modify-default-score-to-0/160111/4 "2018-12-10T08:57:49Z")

</div>

Thanks for the suggestion:)

---

<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: [January 7, 2019, 8:57am UTC](https://discuss.elastic.co/t/how-to-modify-default-score-to-0/160111/5 "2019-01-07T08:57:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
