# Sorting by date vs date\_nanos

**URL:** <https://discuss.elastic.co/t/sorting-by-date-vs-date-nanos/209342>\
**Category:** Elasticsearch\
**Created:** [November 25, 2019, 4:09pm UTC](https://discuss.elastic.co/t/sorting-by-date-vs-date-nanos/209342 "2019-11-25T16:09:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NZangelidis](https://avatars.discourse-cdn.com/v4/letter/n/34f0e0/32.png) [@NZangelidis](https://discuss.elastic.co/u/NZangelidis)\
**Post date:** [November 25, 2019, 4:09pm UTC](https://discuss.elastic.co/t/sorting-by-date-vs-date-nanos/209342/1 "2019-11-25T16:09:18Z")

</div>

Hello,

In our test environment we have been indexing documents with a date data type with this format yyyy-MM-ddTHH:mm:ssZ, and using that for searching and sorting. However we were trying to do pagination and since we have many documents with the same date, the same documents might appear on different pages during searches.  
To solve this we added a new integer mapping and sort by both the date and the integer and get a consistent sort each time. This however has slowed down the search speed.  
We are considering adding a date\_nanos field to use for both searching and sorting.

My question is if we replace date with date\_nanos field how hard will it impact the search performance. Should we use a date\_nanos just for sorting and date for searching or just use one for both?

---

<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:** [December 23, 2019, 4:09pm UTC](https://discuss.elastic.co/t/sorting-by-date-vs-date-nanos/209342/2 "2019-12-23T16:09:24Z")

</div>

Closed on December 23, 2019, 4:09pm UTC

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