# Nested aggregation in Kibana Dashboard

**URL:** <https://discuss.elastic.co/t/nested-aggregation-in-kibana-dashboard/307871>\
**Category:** Kibana\
**Created:** [June 22, 2022, 11:25am UTC](https://discuss.elastic.co/t/nested-aggregation-in-kibana-dashboard/307871 "2022-06-22T11:25:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandeep\_Raju](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sandeep\_Raju](https://discuss.elastic.co/u/Sandeep_Raju)\
**Post date:** [June 22, 2022, 11:25am UTC](https://discuss.elastic.co/t/nested-aggregation-in-kibana-dashboard/307871/1 "2022-06-22T11:25:50Z")

</div>

Hi all,

Let's say there is **Fruits database**

Based on terms aggregation we have count of Oranges - 5 & Pears -3 & Apples - 3.

Now 2 fruit categories (Pears & Apples ) have 3 as count. So here I have nested aggregation of **2**. What I want is 2 here.  
I can get this from nested aggregation in an elastic query.  
But How do i implement this in a kibana dashboard?

---

<div class="post-metadata">

**Author:** ![majagrubic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/majagrubic/32/74459_2.png) [@majagrubic](https://discuss.elastic.co/u/majagrubic)\
**Post date:** [June 22, 2022, 12:11pm UTC](https://discuss.elastic.co/t/nested-aggregation-in-kibana-dashboard/307871/2 "2022-06-22T12:11:13Z")

</div>

You can create an aggreagation-based visualization and add it to the Dashboard.

---

<div class="post-metadata">

**Author:** ![Sandeep\_Raju](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sandeep\_Raju](https://discuss.elastic.co/u/Sandeep_Raju)\
**Post date:** [June 22, 2022, 12:24pm UTC](https://discuss.elastic.co/t/nested-aggregation-in-kibana-dashboard/307871/3 "2022-06-22T12:24:54Z")

</div>

How can i do that?

Basically it is taking Count of ( Count of Fruits).

I have to aggregate again to metric count which is not possible in visualization

---

<div class="post-metadata">

**Author:** ![majagrubic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/majagrubic/32/74459_2.png) [@majagrubic](https://discuss.elastic.co/u/majagrubic)\
**Post date:** [June 22, 2022, 12:30pm UTC](https://discuss.elastic.co/t/nested-aggregation-in-kibana-dashboard/307871/4 "2022-06-22T12:30:04Z")

</div>

oh sorry, just realized you are trying to visualize a nested aggregation. I am afraid Kibana does not aggregate on nested documents. We have an issue for that, which you can follow [here].([Nested field support · Issue #1084 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/1084))

However, if you can build a query directly, you can potentially use the Vega visualization which supports direct querying. [https://www.elastic.co/blog/custom-vega-visualizations-in-kibana](https://www.elastic.co/blog/custom-vega-visualizations-in-kibana)

---

<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 20, 2022, 12:30pm UTC](https://discuss.elastic.co/t/nested-aggregation-in-kibana-dashboard/307871/5 "2022-07-20T12:30:51Z")

</div>

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