# Why Nested Aggregations do not perform well

**URL:** <https://discuss.elastic.co/t/why-nested-aggregations-do-not-perform-well/135867>\
**Category:** Elasticsearch\
**Created:** [June 14, 2018, 8:06am UTC](https://discuss.elastic.co/t/why-nested-aggregations-do-not-perform-well/135867 "2018-06-14T08:06:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![neelam.mamtani](https://avatars.discourse-cdn.com/v4/letter/n/71c47a/32.png) [@neelam.mamtani](https://discuss.elastic.co/u/neelam.mamtani)\
**Post date:** [June 14, 2018, 8:06am UTC](https://discuss.elastic.co/t/why-nested-aggregations-do-not-perform-well/135867/1 "2018-06-14T08:06:03Z")

</div>

Hi,  
I have been trying a couple of queries which includes nested aggregations and filteredAggregations with subAggregation. But I have heard the fact that try to reduce nesting in aggregation since they degrade the performance. I have searched but haven't got any reason for the same. Can someone explain what happens internally when nested aggregation is used?  
I know aggregation uses doc\_values. For nested aggregations are they joined with themselves to get results OR how lucene sees these queries. Any help would be appreciated.

---

<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 12, 2018, 8:06am UTC](https://discuss.elastic.co/t/why-nested-aggregations-do-not-perform-well/135867/2 "2018-07-12T08:06:13Z")

</div>

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