# Incorrect date range in response and interval in date\_histogram

**URL:** <https://discuss.elastic.co/t/incorrect-date-range-in-response-and-interval-in-date-histogram/239393>\
**Category:** Kibana\
**Created:** [July 1, 2020, 3:00am UTC](https://discuss.elastic.co/t/incorrect-date-range-in-response-and-interval-in-date-histogram/239393 "2020-07-01T03:00:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakesh\_Sinha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakesh_sinha/32/45283_2.png) [@Rakesh\_Sinha](https://discuss.elastic.co/u/Rakesh_Sinha)\
**Post date:** [July 1, 2020, 3:00am UTC](https://discuss.elastic.co/t/incorrect-date-range-in-response-and-interval-in-date-histogram/239393/1 "2020-07-01T03:00:32Z")

</div>

I am trying to run the below query:

```auto
      query: {
        bool: {
          must: [
            { match: { app: 'myapp'} },
            {
              range: {
                timestamp: {
                  lt: '2020-06-30T00:00:00.000'
                  gte: '2020-07-02T00:00:00.000'
                },
              },
            },
          ],
        },
      },
      aggs: {
        activeCustomers: {
          terms: { field: 'json.member.id.keyword' },
          aggs: {
            data: {
              date_histogram: {
                field: 'timestamp',
                interval: '15m',
              },
            },
          },
        },
      }

```

The response i am getting is out of the date range, that i have mentioned in range field. The actual response is:

{  
startDateTime: '2020-06-30T00:00:00.000+05:30',  
endDateTime: '2020-07-02T00:00:00.000+05:30',  
interval: '15m',  
dataPoints: [  
{ label: '2020-06-15T11:15:00.000Z', value: 1 },  
{ label: '2020-06-15T11:30:00.000Z', value: 1 },  
{ label: '2020-06-15T11:45:00.000Z', value: 1 },  
{ label: '2020-06-15T12:00:00.000Z', value: 1 },  
{ label: '2020-06-15T12:15:00.000Z', value: 1 },  
{ label: '2020-06-15T12:30:00.000Z', value: 0 },  
{ label: '2020-06-15T12:45:00.000Z', value: 1 },  
{ label: '2020-06-15T13:00:00.000Z', value: 1 },  
{ label: '2020-06-15T13:15:00.000Z', value: 0 },  
{ label: '2020-06-15T13:30:00.000Z', value: 0 },  
{ label: '2020-06-15T13:45:00.000Z', value: 0 },  
{ label: '2020-06-15T14:00:00.000Z', value: 0 },  
{ label: '2020-06-15T14:15:00.000Z', value: 0 },  
{ label: '2020-06-15T14:30:00.000Z', value: 0 },  
{ label: '2020-06-15T14:45:00.000Z', value: 0 },  
{ label: '2020-06-15T15:00:00.000Z', value: 0 },  
{ label: '2020-06-15T15:15:00.000Z', value: 0 },  
{ label: '2020-06-15T15:30:00.000Z', value: 0 },  
{ label: '2020-06-15T15:45:00.000Z', value: 0 },  
{ label: '2020-06-15T16:00:00.000Z', value: 0 },  
{ label: '2020-06-15T16:15:00.000Z', value: 0 },  
... 1360 more items  
]  
}

It returns me data from 2020-06-15, thou I have mentioned the date range should be greater than 2020-06-25.  
Also, in the date\_histogram aggregation, if change the interval to '1m' or '5m', it doen't return me any response, but intervals like '15m' or '1h' its returns me the above response.

Please look at this issue. Thanks in advance.

Thanks!

---

<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:** [July 29, 2020, 3:00am UTC](https://discuss.elastic.co/t/incorrect-date-range-in-response-and-interval-in-date-histogram/239393/2 "2020-07-29T03:00:36Z")

</div>

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