# Histogram won't respect minimum value on extended\_bound with timezone for weekly aggregation

**URL:** <https://discuss.elastic.co/t/histogram-wont-respect-minimum-value-on-extended-bound-with-timezone-for-weekly-aggregation/141449>\
**Category:** Elasticsearch\
**Created:** [July 24, 2018, 9:32pm UTC](https://discuss.elastic.co/t/histogram-wont-respect-minimum-value-on-extended-bound-with-timezone-for-weekly-aggregation/141449 "2018-07-24T21:32:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![patelh18](https://avatars.discourse-cdn.com/v4/letter/p/a88e4f/32.png) [@patelh18](https://discuss.elastic.co/u/patelh18)\
**Post date:** [July 24, 2018, 9:32pm UTC](https://discuss.elastic.co/t/histogram-wont-respect-minimum-value-on-extended-bound-with-timezone-for-weekly-aggregation/141449/1 "2018-07-24T21:32:37Z")

</div>

Here is my query. I have range and then aggregation. Both queries have timezone and start and end date on them.

So if you look at the first bucket on weekly aggregation for key 4138 it started from 1529798400000 but min value on extended bound is 1530403200000.

`{ "query": { "bool": { "must": [{ "query_string": { "query": "data.owner_id:82" } }, { "range": { "@timestamp": { "gt": "2018-07-01T00:00:00", "lte": "2018-07-09T23:59:59", "format": "yyyy-MM-dd'T'HH:mm:ss", "time_zone": "+00:00" } } }] } }, "size": 0, "aggs": { "resultSet": { "terms": { "field": "data.asset_id", "size": 10000, "order": { "_count": "desc" } }, "aggs": { "weekly": { "date_histogram": { "offset": "-1d", "field": "@timestamp", "interval": "week", "min_doc_count": 0, "time_zone": "+00:00", "extended_bounds": { "min": 1530403200000, "max": 1531180799000 }, "order": { "_key": "asc" } }, "aggs": { "types": { "terms": { "field": "_type", "order": { "_count": "desc" } }, "aggs": { "progress": { "terms": { "field": "data.growth", "order": { "_count": "desc" } }, "aggs": { "count": { "sum": { "field": "data.count" } } } } } } } } } } } }`

`{ "aggregations": { "resultSet": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [{ "key": 4138, "doc_count": 2537, "weekly": { "buckets": [ { "key_as_string": "2018-06-24T00:00:00.000Z", "key": 1529798400000, "doc_count": 0, "types": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key_as_string": "2018-07-01T00:00:00.000Z", "key": 1530403200000, "doc_count": 2482, "types": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key_as_string": "2018-07-08T00:00:00.000Z", "key": 1531008000000, "doc_count": 55, "types": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [{ "key": "1", "doc_count": 13, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key": "3", "doc_count": 11, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key": "7", "doc_count": 10, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key": "8", "doc_count": 6, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key": "11", "doc_count": 5, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key": "9", "doc_count": 5, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key": "10", "doc_count": 3, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } }, { "key": "5", "doc_count": 2, "progress": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } } ] } } ] } } ] } } }`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 21, 2018, 9:32pm UTC](https://discuss.elastic.co/t/histogram-wont-respect-minimum-value-on-extended-bound-with-timezone-for-weekly-aggregation/141449/2 "2018-08-21T21:32:38Z")

</div>

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