# How to return multiple inner hits in multiple nested sub-queries for the same path?

**URL:** <https://discuss.elastic.co/t/how-to-return-multiple-inner-hits-in-multiple-nested-sub-queries-for-the-same-path/149367>\
**Category:** Elasticsearch\
**Created:** [September 20, 2018, 10:34pm UTC](https://discuss.elastic.co/t/how-to-return-multiple-inner-hits-in-multiple-nested-sub-queries-for-the-same-path/149367 "2018-09-20T22:34:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NewHere](https://avatars.discourse-cdn.com/v4/letter/n/5e9695/32.png) [@NewHere](https://discuss.elastic.co/u/NewHere)\
**Post date:** [September 20, 2018, 10:34pm UTC](https://discuss.elastic.co/t/how-to-return-multiple-inner-hits-in-multiple-nested-sub-queries-for-the-same-path/149367/1 "2018-09-20T22:34:49Z")

</div>

When I have multiple nested sub-queries for the same path, it seems the result will only include the inner hits result of the last nested sub-query. Is there a way to return all of the inner hits results for the multiple nested sub-queries? @Tim_Brooks @jimczi

e.g.

```
{
    "query": {
        "bool: {
            "must": [{
                "nested": {
                    "query": {...},
                    "path": "path_a",
                    "inner_hits": {}
                }
            },{
                "nested": {
                    "query": {...},
                    "path": "path_a",
                    "inner_hits": {}
                }
            }]
        }
    }
}
```

---

<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 18, 2018, 10:35pm UTC](https://discuss.elastic.co/t/how-to-return-multiple-inner-hits-in-multiple-nested-sub-queries-for-the-same-path/149367/2 "2018-10-18T22:35:02Z")

</div>

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