How to aggregation by tree(Bar Chart)

My data look like this:

{
	"type":"Error",
	"server":["Country1/State1/City1",null]
}

{
	"type":"Error",
	"server":["Country1/State2/City2",null]
}

{
	"type":"Error",
	"server":["Country2/State3/City3",null]
}

I want to create a bar chart which count by country first, when user click one of the country bar, the chart refresh and show the count by state.

Can I do this with Kibana?

Hi.
"when user click one of the country bar, the chart refresh and show the count by state" I think that is impossible, but you can try drilldown:

Make dashboards interactive | Kibana Guide [8.11] | Elastic

You can create two dashboards:

  1. First contains "All Country" like this

  2. Second contains "All State" like this:

(You can add more dashboards: city, street etc...)

On first (All Country) you can add drilldown (see first screen), by click on that you will go to second dashboard with filter by country:

And on dashboard "All State" you will see:

But I don`t understand your data... I created simple index like this:
GET cstate/_source/1
{
"server" : "1",
"country" : "US",
"state" : "Alaska"
}

etc...
I hope it will help...

Thanks! But my client want to do this with one chart. :joy:

The drilldown approach above is currently the only way to do this in Kibana.

Create two maximum similar dashboards and
your client won't see the difference between drilldown and refresh (may be only filter in up corner) :rofl:

1 Like

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