# Sorting histogram aggregation

**URL:** <https://discuss.elastic.co/t/sorting-histogram-aggregation/63310>\
**Category:** Elasticsearch\
**Created:** [October 18, 2016, 3:00pm UTC](https://discuss.elastic.co/t/sorting-histogram-aggregation/63310 "2016-10-18T15:00:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frederes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frederes/32/12476_2.png) [@frederes](https://discuss.elastic.co/u/frederes)\
**Post date:** [October 18, 2016, 3:00pm UTC](https://discuss.elastic.co/t/sorting-histogram-aggregation/63310/1 "2016-10-18T15:00:43Z")

</div>

I have a request like this :

{  
"aggs": {  
"days" : {  
"date\_histogram" : {  
"field" : "day",  
"interval" : "day",  
"format": "yyyy-MM-dd",  
"min\_doc\_count" : 1  
},  
"aggs": {  
"total\_impressions" : { "sum" : { "field" : "impressions" } }  
}  
}  
}  
}

How can i specify the sorting order for 'days' field ? (they are default ordered ASC in my case)

Thanks for your help 😉

---

<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:11pm UTC](https://discuss.elastic.co/t/sorting-histogram-aggregation/63310/2 "2017-07-05T22:11:31Z")

</div>


