Hi,
I'm using elasticsearch 7.X and I'm having difficulties querying a time range.
My code
res = es.search(index='*', body={
'query': {
'range': {
'app_timestamp':{
'gte': '2019-06-20T12:00:00',
'lte': '2019-06-20T14:00:00',
'time_zone': '+07:00'
}
}
}
})
Some of the data
{
"_index": "some_index",
"_type": "SOME_TYPE",
"_id": "amG7dmsBLEIGz_GafLkN",
"_version": 1,
"_score": 0,
"_source": {
"raw_message": "2019-06-20 13:56:20,144 DETAILS",
"app_timestamp": "2019-06-20 13:56:20,144",
},
{
"_index": "some_index",
"_type": "SOME_TYPE",
"_id": "h6WsdmsBa0Tg62_0xLj1",
"_version": 1,
"_score": 0,
"_source": {
"raw_message": "2019-06-20 13:56:02,347 GIVE ME DETAILS",
"app_timestamp": "2019-06-20 13:56:02,347"
}
},
{
"_index": "some_index",
"_type": "SOME_TYPE",
"_id": "h6WsdmsBa0Tg62_0xLj1",
"_version": 1,
"_score": 0,
"_source": {
"raw_message": "2019-06-20 13:56:02,247 GIVE ME DETAILS",
"app_timestamp": "2019-06-20 13:56:02,247"
}
}
The result is the following:
{'_shards': {'failed': 0, 'skipped': 0, 'successful': 4, 'total': 4},
'hits': {'hits': [],
'max_score': None,
'total': {'relation': 'eq', 'value': 0}},
'timed_out': False,
'took': 0}
I've tried changing my index to 'some_index' also.
Thanks in advance,
Ry