Reputation: 23187
I'm trying to get aggregated information from a datetime field:
Thanks for all.
Upvotes: 0
Views: 48
Reputation: 2270
You can use format
parameter of date-histogram
aggregation and chose only month
field in that. Your aggregation would look like
{
"aggs": {
"documents_by_month": {
"date_histogram": {
"field": "date",
"interval": "1M",
"format": "MM"
},
"aggs": {
"documents": {
//... your sub aggregation
}
}
}
}
}
Upvotes: 1