# Filter\_path in POST Body

**URL:** <https://discuss.elastic.co/t/filter-path-in-post-body/250776>\
**Category:** Elasticsearch\
**Created:** [October 2, 2020, 10:58am UTC](https://discuss.elastic.co/t/filter-path-in-post-body/250776 "2020-10-02T10:58:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dev-Flo](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@Dev-Flo](https://discuss.elastic.co/u/Dev-Flo)\
**Post date:** [October 2, 2020, 10:58am UTC](https://discuss.elastic.co/t/filter-path-in-post-body/250776/1 "2020-10-02T10:58:05Z")

</div>

Hey,

the responses I get from Elastisearch are rather huge. I've found out that it is possible to remove data of responses by using response filtering:

> **[Common options | Elasticsearch Reference \[7.9\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#common-options-response-filtering)**

Is there any way to put the filter inside a POST body so that I could use in a query like this:

```auto
window.fetch(Config.serverUrl, {
      method: 'POST',
      mode: 'cors',
      body: JSON.stringify({
        'query': {     
            'bool': {
              'should': [
                {
                  'match': {
                    'type': 'GatewayClosed'
                  }
                }, {
                  'match': {
                    'type': 'GatewayStarted'
                  }
                }
              ]
            }
        },
        "size": 0,
        "aggregations": {
          "Gateways": {
            "terms": {
              "field": "source.keyword",
              "size": 10000  
            },

            "aggs": {
              "Information": {
                "top_hits": {
                  "sort": [
                    {
                      "@timestamp": {
                        "order": "desc"
                      }
                    }
                  ],
                  "_source": {
                    "includes": ["source", "timestamp", "type"]
                  },
                  "size": 1
                }
              }
            }
          }
        }

      }
)

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 2, 2020, 11:07am UTC](https://discuss.elastic.co/t/filter-path-in-post-body/250776/2 "2020-10-02T11:07:16Z")

</div>

Hey,

the `filter_path` always must be a parameter and cannot be included in the body.

--Alex

---

<div class="post-metadata">

**Author:** ![Dev-Flo](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@Dev-Flo](https://discuss.elastic.co/u/Dev-Flo)\
**Post date:** [October 2, 2020, 12:09pm UTC](https://discuss.elastic.co/t/filter-path-in-post-body/250776/3 "2020-10-02T12:09:57Z")

</div>

Alright. Thank you.

---

<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:** [October 30, 2020, 12:10pm UTC](https://discuss.elastic.co/t/filter-path-in-post-body/250776/4 "2020-10-30T12:10:00Z")

</div>

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