I am aggregating records where I have a field samplingDate
and a field users
.
I want to get a weekly aggregation, where the last item in the bucket is from the last date in the range, but I cannot find a way to force it, because in the example below, the last bucket is from 2016-09-01. Thanks.
{
"query": {
"range": {
"samplingDate": {
"gte": "2016-08-14",
"lte": "2016-09-05"
}
}
},
"aggs": {
"scannedPerMonth": {
"date_histogram": {
"field": "samplingDate",
"interval": "7d"
},
"aggs": {
"totalScanned": {
"max": {
"field": "users"
}
}
}
}
}
}