Extended_bounds causes extra bucket

Hi,

I am using date_histogram to get data in buckets grouped by time. Interval is weekly with offset of -1d, and time_zone is +08:00. The min value is equal to the "gte". When using extended_bounds, I get an extra bucket for the week before if the query starts on Sunday.

My guess is the offset is not being accounted for in the extended bounds. Is this the case?

Thanks.

Can you paste the query and response? What are you setting the extended_bounds to?

Hi,

Sorry for the late reply. Here it is:

POST my_index/my_type/_search
{
  "query": {
"bool": {
  "must": [
    {
      "range": {
        "transactionTime": {
          "gte": "2018-10-28T00:00:00+08:00",
          "lte": "2018-12-30T23:53:53+08:00",
          "time_zone": "+08:00"
        }
      }
    },
    {
      "match": {
        "name": "John.Doe"
      }
    },
    {
      "terms": {
        "action": [
          "CHECKIN",
          "CHECKOUT",
          "CANCELLED"
        ]
      }
    }
  ]
    }
  },
  "aggs": {
"group_by_action": {
  "terms": {
    "field": "action",
    "min_doc_count": 0
  },
  "aggs": {
    "group_by_interval": {
      "date_histogram": {
        "field": "transactionTime",
        "offset": "-1d",
        "interval": "1w",
        "time_zone": "+08:00",
        "min_doc_count": 0,
        "extended_bounds": {
          "min": 1540656000000,
          "max": 1546185233000
        }
      }
    }
  }
}
  }
}

The output will have a bucket that includes October 21, 2018 instead of starting with October 28.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.