# Timezone with negative (minus) value return more bucket before gte range

**URL:** <https://discuss.elastic.co/t/timezone-with-negative-minus-value-return-more-bucket-before-gte-range/262133>\
**Category:** Elasticsearch\
**Created:** [January 25, 2021, 4:13pm UTC](https://discuss.elastic.co/t/timezone-with-negative-minus-value-return-more-bucket-before-gte-range/262133 "2021-01-25T16:13:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anas-hossam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anas-hossam/32/82862_2.png) [@anas-hossam](https://discuss.elastic.co/u/anas-hossam)\
**Post date:** [January 25, 2021, 4:13pm UTC](https://discuss.elastic.co/t/timezone-with-negative-minus-value-return-more-bucket-before-gte-range/262133/1 "2021-01-25T16:13:00Z")

</div>

i am trying to get docs matching query from elastic v1.5

```auto
{
    "range": {
        "create_time": {
            "gte": "2020-07-20T00:00:00",
            "lte": "2020-07-30T23:59:59",
            "time_zone": "-2:00"
        }
    }
}

```

and aggregate result using date histogram by interval day

```auto
{
    "posts_over_time": {
        "date_histogram": {
            "field": "create_time",
            "interval": "day",
            "min_doc_count": 0,
            "time_zone": "-2:00",
            "format": "yyyy-MM-dd",
            "extended_bounds": {
                "min": "2020-07-20",
                "max": "2020-07-30"
            }
        },
        "aggs": {
            "Sum of engagements": {
                "sum": {
                    "field": "interactions_count"
                }
            }
        }
    }
}

```

and buckets that returned have **one more day '2020-07-19' before first date '2020-07-20' and this happened only when sending negative timezone** , how can i return only days within range ?!

---

<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:** [February 22, 2021, 4:13pm UTC](https://discuss.elastic.co/t/timezone-with-negative-minus-value-return-more-bucket-before-gte-range/262133/2 "2021-02-22T16:13:12Z")

</div>

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