# Allow post\_filter access to the \_score value

**URL:** <https://discuss.elastic.co/t/allow-post-filter-access-to-the--score-value/58779>\
**Category:** Elasticsearch\
**Created:** [August 24, 2016, 7:18am UTC](https://discuss.elastic.co/t/allow-post-filter-access-to-the--score-value/58779 "2016-08-24T07:18:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmitry\_polushkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dmitry_polushkin/32/1326_2.png) [@dmitry\_polushkin](https://discuss.elastic.co/u/dmitry_polushkin)\
**Post date:** [August 24, 2016, 7:18am UTC](https://discuss.elastic.co/t/allow-post-filter-access-to-the--score-value/58779/1 "2016-08-24T07:18:07Z")

</div>

I found it's allowed to `access _score` inside the `aggs`, but not allowed to access this field in the `post_filter` queries, though it's executed after the `aggs`. Is there a reason for that it's not accessible or it could be added in the Elasticsearch in the future versions?

An example query:

```auto
{
  "body": {
    "post_filter": {
      "script": {
        "script": "_score > 100 && _score < 200"
      }
    },
    "query": {
      "function_score": {
        "functions": [{
          "script_score": {
            "script": "doc['price'].value * 100"
          }
        }]
      }
    }
  },
  "index": ["items"],
  "type": []
}

```

`script_score` could be much more complex, it's just an example.

Please comment also here on the github issue: [https://github.com/elastic/elasticsearch/issues/20131](https://github.com/elastic/elasticsearch/issues/20131)

Related problem to this issue: [http://stackoverflow.com/questions/39109511/how-to-filter-by-script-field-in-elasticsearch?noredirect=1&lq=1](http://stackoverflow.com/questions/39109511/how-to-filter-by-script-field-in-elasticsearch?noredirect=1&lq=1)

---

<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:25pm UTC](https://discuss.elastic.co/t/allow-post-filter-access-to-the--score-value/58779/2 "2017-07-05T22:25:41Z")

</div>


