# Need to return the most recent record by timestamp

**URL:** <https://discuss.elastic.co/t/need-to-return-the-most-recent-record-by-timestamp/147842>\
**Category:** Elasticsearch\
**Created:** [September 9, 2018, 5:17am UTC](https://discuss.elastic.co/t/need-to-return-the-most-recent-record-by-timestamp/147842 "2018-09-09T05:17:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajesh.ramadoss](https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/32.png) [@rajesh.ramadoss](https://discuss.elastic.co/u/rajesh.ramadoss)\
**Post date:** [September 9, 2018, 5:17am UTC](https://discuss.elastic.co/t/need-to-return-the-most-recent-record-by-timestamp/147842/1 "2018-09-09T05:17:34Z")

</div>

Hello everyone, I need to return the most recent record for every serial by timestamp  
how can i query that ?  
For e.g

Serial State . Time  
AP01 . Up .  
AP02 . Down  
AP01 . Down  
AP02 . UP

The output should be  
AP01 . Up  
AP02 . Down

Please suggest

Thanks in advance

---

<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:** [October 7, 2018, 5:17am UTC](https://discuss.elastic.co/t/need-to-return-the-most-recent-record-by-timestamp/147842/2 "2018-10-07T05:17:40Z")

</div>

Closed on October 7, 2018, 5:17am UTC

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