Hi Team,
I am using date_histogram type of aggregation for aggregating month level data and interval as Week(1w). Now, In the response 'key' value comes as start date of the week. But I would like to get end date of the week in 'key'. Could you please help.
eg.,
The aggregation query I am using,
"aggs": {
"Weekly_Counts": {
"date_histogram": {
"field": "created",
"interval": "1w",
"format":"yyyy-MM-dd E",
"time_zone":"Asia/Calcutta",
"min_doc_count": 1
}
}
}
the output i am getting like below. In 'key; the time is of start date of the week. Instead I would like to get end date of the week. Would you please help.
{
....
"aggregations": {
"Weekly_Counts": {
"buckets": [
{
"key_as_string": "2018-01-01 Mon",
"key": 1514745000000,
"doc_count": 7672
},
{
"key_as_string": "2018-01-08 Mon",
"key": 1515349800000,
"doc_count": 7754
},
{
"key_as_string": "2018-01-15 Mon",
"key": 1515954600000,
"doc_count": 7643
}
]
}
}
}
Expectation:
In key, I would like to get the end date of the week as "2018-01-07 Sun"