# Sorting using date field is fetching wrong records

**URL:** <https://discuss.elastic.co/t/sorting-using-date-field-is-fetching-wrong-records/59549>\
**Category:** Elasticsearch\
**Created:** [September 1, 2016, 12:28pm UTC](https://discuss.elastic.co/t/sorting-using-date-field-is-fetching-wrong-records/59549 "2016-09-01T12:28:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![es\_user\_cluster](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@es\_user\_cluster](https://discuss.elastic.co/u/es_user_cluster)\
**Post date:** [September 1, 2016, 12:28pm UTC](https://discuss.elastic.co/t/sorting-using-date-field-is-fetching-wrong-records/59549/1 "2016-09-01T12:28:21Z")

</div>

Hi  
I have an issue with the sorting of date fields in elasticsearch.  
I have a date field as updateDate, When I try to sort based on this field , It is fetching me inappropriate records.  
Like if i have records from January to September, at times , when i sort and fetch the records , instead of january i get the records of april month at the top.

Facing this issue when we have many records (more than 10,000 records)  
This is the builder generated :  
"sort" : [ {  
"updateDate" : {  
"order" : "desc"  
}  
} ]

This is the mapping used:  
"updateDate" : {  
"type" : "date",  
"format" : "yyyy-MM-dd HH:mm:ss"  
}

---

<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:** [July 5, 2017, 10:23pm UTC](https://discuss.elastic.co/t/sorting-using-date-field-is-fetching-wrong-records/59549/2 "2017-07-05T22:23:17Z")

</div>


