Pie with specific metrics

Hello, I'm trying to do something tricky. In my JSON file that I parse, I have 4 counters.
I want to have this result (I take the latest value of the counters by doing a sort on time) but in a pie where a slice is proportional to the number of the counters

If you see a way even hacky to do this I'm all ears

You won't be able to do this in Kibana with the current data model. The slices in a pie chart are based on buckets that contain different documents, not different values from the same document. You could do this with a different data model though.

Instead of putting all 4 count types in a single document, try creating a doc for each one. Imagine a document with the following fields: @timestamp, alarmType, and count.

A single document might look like this:

{
  "@timestamp": "2019-07-19T19:24:52.570Z",
  "alarmType": "critical",
  "count": 26
}

Now in your pie chart configuration you can create buckets with a terms aggregation on the alarmType field and configure a Top Hit metric on the count field. This will give you a pie chart where the slices are proportional to the latest count of each alarm type.

Here's an example visualization configuration using a terms agg and a top hit metric.

1 Like

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