Nested aggregation in Kibana Dashboard

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?

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

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

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)

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