# SORT BY DATE issues, the results are NOT SORTED, OUT OF ORDER

**URL:** <https://discuss.elastic.co/t/sort-by-date-issues-the-results-are-not-sorted-out-of-order/18547>\
**Category:** Elasticsearch\
**Created:** [July 9, 2014, 7:45am UTC](https://discuss.elastic.co/t/sort-by-date-issues-the-results-are-not-sorted-out-of-order/18547 "2014-07-09T07:45:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Lan](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Michael\_Lan](https://discuss.elastic.co/u/Michael_Lan)\
**Post date:** [July 9, 2014, 7:45am UTC](https://discuss.elastic.co/t/sort-by-date-issues-the-results-are-not-sorted-out-of-order/18547/1 "2014-07-09T07:45:22Z")

</div>

This is a simple SORT BY DATE query.  
The mapping is  
...  
"publish\_date": {  
"type": "date",  
"format": "yyyy-MM-dd HH:mm"  
}  
...  
The query is  
...  
"sort": [  
{  
"publish\_date": {  
"order": "desc"  
}  
}  
]  
...  
It works fine on staging environment, but OUT OF ORDER on production environment.  
On staging, each "hits" has a field like this  
"sort" : [1404906600000]  
I think this is the time in millisecond.

But on production, each "hits" has a field like this  
"sort" : ["\\b"]  
And the results are OUT OF ORDER

Anybody help me?

---

<div class="post-metadata">

**Author:** ![Michael\_Lan](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Michael\_Lan](https://discuss.elastic.co/u/Michael_Lan)\
**Post date:** [July 9, 2014, 9:37am UTC](https://discuss.elastic.co/t/sort-by-date-issues-the-results-are-not-sorted-out-of-order/18547/2 "2014-07-09T09:37:38Z")

</div>

"sort" : ["\\b"]  
looks like a regular expression "Word Boundaries".

---

<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 6, 2017, 1:17am UTC](https://discuss.elastic.co/t/sort-by-date-issues-the-results-are-not-sorted-out-of-order/18547/3 "2017-07-06T01:17:02Z")

</div>


