# Want to fetch latest record from the list of records in kibana using DSL query

**URL:** <https://discuss.elastic.co/t/want-to-fetch-latest-record-from-the-list-of-records-in-kibana-using-dsl-query/207081>\
**Category:** Kibana\
**Created:** [November 8, 2019, 9:40am UTC](https://discuss.elastic.co/t/want-to-fetch-latest-record-from-the-list-of-records-in-kibana-using-dsl-query/207081 "2019-11-08T09:40:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [November 18, 2019, 6:45pm UTC](https://discuss.elastic.co/t/want-to-fetch-latest-record-from-the-list-of-records-in-kibana-using-dsl-query/207081/2 "2019-11-18T18:45:19Z")

</div>

You need to set the sorting field for top hit to your timestamp in order to get the latest document.  
Easy way to debug would be this: set it up in a metric visualization and use inspector to look at how the request is built.  
This is how to do it in a metric visualization: [Display latest value in a „Metric“](https://discuss.elastic.co/t/display-latest-value-in-a-metric/114930/2)

---

_[View the full topic](https://discuss.elastic.co/t/want-to-fetch-latest-record-from-the-list-of-records-in-kibana-using-dsl-query/207081)._
