I am trying to create an aggregation on a date field (in my case, named "startDate") that will put documents into buckets based upon the startDate month (while ignoring the year). For example, documents with a start date of 2017-Jan-30 and 2016-Jan-12 should go into the same bucket.
Ultimately I would like my aggregation response to be something like this:
"aggregations": {
"startDateByMonth": {
"buckets": [
{
"key_as_string": "01",
"key": "January",
"doc_count": 3
},
{
"key_as_string": "02",
"key": "February",
"doc_count": 1
},
{
"key_as_string": "03",
"key": "March",
"doc_count": 6
},
//Other months with doc_counts
}
I have tried using the Date Histogram aggregation but I don't think it is quite what I need, or at least I'm not seeing what I need to do.
I would appreciate if anyone has any ideas.
Thanks,
Steve