Get only the last record of an index in Kibana

Hello everyone, I'm trying to do a visualization of "live events", therefore, I want to see only the last record inserted in an index in Kibana, can you help me with this? Thanks!

Are you wanting to show a single value from the record or the whole record itself? If you are looking for a single value, you can use a Lens visualization using the "Last value" metric.

Thanks for your response. I'm looking for the whole record itself.

I have a index with some events inside, lets say:

{
eventId: 1
timestamp: 01/03/2023 10:00:00
},
{
eventId: 2,
timestamp: 01/03/2023 10:01:00
},
{
eventId: 3,
timestamp: 01/03/2023 10:02:00
}

In a dashboard, I want to get the latest record inserted (in this case eventId: 3). So is there any way to apply an aggregation like:

"aggs": {
        "latest": {
          "top_hits": {
            "size": 1,
            "sort": [
              {
                 "date": { 
                    "order": "desc"
                 }
              }
            ]                   
          }

To my Kibana dashboard?

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