I have ElasticSearch analytic query. It must aggregate sum by 7d buckets. Also I've use extended bounds. But result buckets starts from wrong date. Elastic 5.2.2 version. What I'm doing wrong?
{
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"doc.dateExecute": {
"from": "2017-07-11",
"to": "2017-07-31",
"include_lower": true,
"include_upper": true,
"boost": 1.0
}
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1.0,
"_name": "onDates"
}
},
"aggregations": {
"time": {
"date_histogram": {
"field": "doc.dateExecute",
"interval": "7d",
"offset": 0,
"order": {
"_key": "asc"
},
"keyed": false,
"min_doc_count": 0,
"extended_bounds": {
"min": "2017-07-11",
"max": "2017-07-31"
}
},
"aggregations": {
"incomingAmount": {
"sum": {
"field": "doc.incomingAmount"
}
},
"outgoingAmount": {
"sum": {
"field": "doc.outgoingAmount"
}
}
}
}
}
}
But buckets starts from "2017-07-06T00:00:00.000Z" and goes by 7d intervals to "2017-07-27T00:00:00.000Z". What I'm missing? Thanks!
Update 1
I'd try a many variants of query. Different timezones, ranges, disabling exteneded_bounds, intervals multiple 7 day. It's works good only for 1-3d intervals.
Update 2 I have tried 7.x. Seems to work fine on latest versions.