Count the latest records in Kibana visualization?

I have document like as below

Every two minutes once the "status" field records will get change and I want to count only the recent status records in Kibana visualization. Ex., The total count of status value 1 is 3 & 0 is 1. I tired with different aggregations but no luck. By using metric aggregation with bucket filter, If I choose the time filter to 2 minutes, I could get the result . But If I change the time range to last 15 minutes its counting all the last 15 minutes records. How can I get only the last recent counts even If change the time range? Any help please.
image

Hi,

Okay so you want a thing like this ? :

image

With the last group of data

Yes.

I think it will be difficult like this. But i have an idea :+1:

You can use Transform (Pivot transform).

You will be able to create new data already aggregated.
Group by on your device, and use top_metric in Aggregations to get the last value

1 Like

Thank you, let me try.

Hello,

You can do this with TSVB Metric. Use count aggregation grouped by status, and on panel options make sure to set data timerange to "last value" and set your interval to 2 minutes. Notice if more than two minutes pass and there hasn't been a new document, you'll get 0 for the count.

Another solution would be to use a Lens datatable with a reduced time range.

First configure the columns of the Table to map the 0/1 values (Top values of <your field>), and configure a Count of Records as metric:

then open the Count of records configuration and click on the Advanced options to configure the Reduced time range to your fixed interval:

Also the new Metric visualization can be nice and perhaps make a best use of the panel space (same configuration as table, just be sure to set the number of values in Top values to 2 to avoid unused padding):

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