I am trying to run the below query:
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!