# Get only the last record of an index in Kibana

**URL:** <https://discuss.elastic.co/t/get-only-the-last-record-of-an-index-in-kibana/326792>\
**Category:** Kibana\
**Created:** [March 1, 2023, 6:17pm UTC](https://discuss.elastic.co/t/get-only-the-last-record-of-an-index-in-kibana/326792 "2023-03-01T18:17:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ismi2002](https://avatars.discourse-cdn.com/v4/letter/i/c6cbf5/32.png) [@ismi2002](https://discuss.elastic.co/u/ismi2002)\
**Post date:** [March 1, 2023, 6:17pm UTC](https://discuss.elastic.co/t/get-only-the-last-record-of-an-index-in-kibana/326792/1 "2023-03-01T18:17:13Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [March 1, 2023, 9:58pm UTC](https://discuss.elastic.co/t/get-only-the-last-record-of-an-index-in-kibana/326792/2 "2023-03-01T21:58:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ismi2002](https://avatars.discourse-cdn.com/v4/letter/i/c6cbf5/32.png) [@ismi2002](https://discuss.elastic.co/u/ismi2002)\
**Post date:** [March 1, 2023, 10:06pm UTC](https://discuss.elastic.co/t/get-only-the-last-record-of-an-index-in-kibana/326792/3 "2023-03-01T22:06:28Z")

</div>

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:

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

```

To my Kibana dashboard?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 29, 2023, 10:07pm UTC](https://discuss.elastic.co/t/get-only-the-last-record-of-an-index-in-kibana/326792/4 "2023-03-29T22:07:23Z")

</div>

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