How to keep the latest row in kibana data table?

First, let's structure your visualization to surface the value you care about, which is status. It looks like your Metrics aggregation is on the status field which is what we want. But instead of "Max" let's use "Top hit" sorted on your time field (descending), which will return the most recent document. This will show only the latest URL status.

Then I think you can add another Metrics aggregation for the response code, again using "Top hit" sorted on time field (descending).

Lastly, I think you only need one bucket aggregation. Specifically, a "Terms" aggregation on the "ScriptedURL" field. This is important because it means we're using this field as the "key", i.e. they unique identifier for each row in the data table.

Does this work for you? If not, we may need to make some adjustments based on how your documents are structured.

Thanks,
CJ

3 Likes