Date formatting failing - string


(javi) #1

Hi

Im using the python library to insert data in elasticsearch

Im trying to format the date i have in epoch format as datetime field

dt = time.strftime('%y-%m-%d %H:%M:%S', time.localtime(float(d['timestamp'])))
dt = datetime.strptime(dt, '%y-%m-%d %H:%M:%S')
d['timestamp']=dt
es.index(index='test', doc_type='json', id=i, body=d)

However, when accessing the data in kibana, the field timestamp is still considered as a string

What should i do to be able to convert this field to a format that elasticsearch can understand?

If i check in discover, the format is like this:

timestamp
2018-06-09T20:17:21

Which looks like a proper timestamp field

Thanks


(system) #2

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