Display latest entry for each unique source in a Grafana table?


I’m using Grafana with Opensearch as my data source. I’ve got a table filled with multiple documents, each with different “source” values like “source1”, “source2”, “source3”, and so on.

What I’m looking to do is this: for each unique source, I want to display only the latest document in my Grafana table. So if I have three sources, I’d only have three documents in the table - the most recent ones from “source1”, “source2”, and “source3”.

I’ve tried to find a way to aggregate on the timestamp field, getting the maximum value for each source. But so far, I’m stuck on how to do this in Grafana.

Can anyone help guide me on how to achieve this?

Thanks in advance for any help you can provide.

1 Like


what is your sample data? You can paste here with redacted sensitive data.
To have specific source, you can use variable, and you can show as selector.

With opensearch that similar with elasticsearch you can use this query for the variable as example:
{"find": "terms", "field": "source", "query": "<your_specific_query"}
That query is for specific index datasource


1 Like