# Group Results of terms aggs in "parent" bucket

**URL:** <https://discuss.elastic.co/t/group-results-of-terms-aggs-in-parent-bucket/268205>\
**Category:** Elasticsearch\
**Created:** [March 24, 2021, 11:57am UTC](https://discuss.elastic.co/t/group-results-of-terms-aggs-in-parent-bucket/268205 "2021-03-24T11:57:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leander1](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Leander1](https://discuss.elastic.co/u/Leander1)\
**Post date:** [March 24, 2021, 11:57am UTC](https://discuss.elastic.co/t/group-results-of-terms-aggs-in-parent-bucket/268205/1 "2021-03-24T11:57:14Z")

</div>

Hey,

I'm trying to group results which I get after doing the terms aggregation. I'm getting the following results:  
hospital 1, doc\_count 20; hospital 2, doc\_count 32; hospital 3, doc\_count 21; facility 1, doc\_count 11; facility 2, doc\_count 33;  
now I would like to summarize these in two buckets: "all\_hospitals", doc\_count 73 and "all\_facilities", doc\_count 44 is there any way do this? thank you very much for your answer

---

<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:** [April 21, 2021, 11:57am UTC](https://discuss.elastic.co/t/group-results-of-terms-aggs-in-parent-bucket/268205/2 "2021-04-21T11:57:23Z")

</div>

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