# How to get maximum date docs?

**URL:** <https://discuss.elastic.co/t/how-to-get-maximum-date-docs/68665>\
**Category:** Elasticsearch\
**Created:** [December 12, 2016, 7:09am UTC](https://discuss.elastic.co/t/how-to-get-maximum-date-docs/68665 "2016-12-12T07:09:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhan](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@madhan](https://discuss.elastic.co/u/madhan)\
**Post date:** [December 12, 2016, 7:09am UTC](https://discuss.elastic.co/t/how-to-get-maximum-date-docs/68665/1 "2016-12-12T07:09:02Z")

</div>

I have docs with data field.

I need to get docs which have maximum date. how to write query in dsl.

I tried of writing aggregation query but it returns 0 result.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 12, 2016, 7:52am UTC](https://discuss.elastic.co/t/how-to-get-maximum-date-docs/68665/2 "2016-12-12T07:52:05Z")

</div>

May be order by date?

---

<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:** [January 9, 2017, 7:52am UTC](https://discuss.elastic.co/t/how-to-get-maximum-date-docs/68665/3 "2017-01-09T07:52:30Z")

</div>

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