I have the following to return a count of documents 'grouped' by the document date. However, I would like the results to be displayed in date order. I tried the 'sort' option but this doesn't seem to work.
Any suggestions ?
GET /my_index/my_type/_search
{
size: 0,
sort: {
date: {
order: "desc"
}
},
aggs: {
"docs_by_date": {
"terms": {
"field": "date",
"size": 0
}
}
}
}