# Disable inner\_hit fields from search api response

**URL:** https://discuss.elastic.co/t/disable-inner-hit-fields-from-search-api-response/239814
**Category:** Elasticsearch
**Created:** [July 3, 2020, 1:31pm UTC](https://discuss.elastic.co/t/disable-inner-hit-fields-from-search-api-response/239814 "2020-07-03T13:31:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![shusson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shusson/32/81893_2.png) [@shusson](https://discuss.elastic.co/u/shusson)
#### Post date: [July 3, 2020, 1:31pm UTC](https://discuss.elastic.co/t/disable-inner-hit-fields-from-search-api-response/239814/1 "2020-07-03T13:31:53Z")

</div>

Is it possible to disable certain inner\_hit fields in the response from the Search API. We have many hits and it is taking up unnecessary memory.

e.g we would like to ES to remove the commented out fields from the response below:

```auto
{
    "took": 82,
    "timed_out": false,
    "_shards": { "total": 10, "successful": 10, "skipped": 0, "failed": 0 },
    "hits": {
        "total": 1,
        "max_score": 1,
        "hits": [
            {
                "inner_hits": {
                    "foo": {
                        "hits": {
                            "total": 252,
                            "max_score": null,
                            "hits": [
                                {
                                    // "_index": "cactus",
                                    // "_type": "_doc",
                                    // "_id": "xxx",
                                    "_nested": { "field": "measurement", "offset": 203 },
                                    // "_score": null,
                                    // "sort": [1565740800000, "1DAA3DB2-30B0-4A8C-90EC-DE0A3DAB9A53"],
                                    "fields": {
                                        "measurement.id": ["1DAA3DB2-30B0-4A8C-90EC-DE0A3DAB9A53"]
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        ]
    }
}

```

---

<div class="post-metadata">

### Author: ![shusson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shusson/32/81893_2.png) [@shusson](https://discuss.elastic.co/u/shusson)
#### Post date: [July 3, 2020, 1:52pm UTC](https://discuss.elastic.co/t/disable-inner-hit-fields-from-search-api-response/239814/2 "2020-07-03T13:52:16Z")

</div>

I found the solution here: [https://www.elastic.co/guide/en/elasticsearch/reference/6.8/common-options.html#common-options-response-filtering](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/common-options.html#common-options-response-filtering)

---

<div class="post-metadata">

### Author: ![Tessmore](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@Tessmore](https://discuss.elastic.co/u/Tessmore)
#### Post date: [July 3, 2020, 2:29pm UTC](https://discuss.elastic.co/t/disable-inner-hit-fields-from-search-api-response/239814/3 "2020-07-03T14:29:29Z")

</div>

You can try filtering using something like:

```auto
?filter_path=hits.hits.inner_hits.*.hits.hits.*.*

```

I am not sure if it has performance implications.

---

<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 31, 2020, 2:29pm UTC](https://discuss.elastic.co/t/disable-inner-hit-fields-from-search-api-response/239814/4 "2020-07-31T14:29:43Z")

</div>

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