Time stamp "_timestamp" working but not displaying in Discover


(Scott) #1

I have an index created with jsonStr := "{"mappings": {"" + typeName + "": {"_timestamp": {"enabled": true}}}}" which is the only way that timestamp data appears to work for me. I'm using the API to add documents using pre-formated JSON. Everything seems to work fine, but on the Discover page in Kibana shows "-" under the Time column instead of the timedate stamp. Also the _timestamp field also does not show up.

Does anyone have any ideas?

ES Version: 2.4.1
Kibana: 4.6.1


(Tim Sullivan) #2

You may be relying on the feature of the _timestamp field to automatically set the time value for you, but you should be warned this feature is deprecated as of Elasticsearch 2.0, and doesn't exist in 5.0: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/mapping-timestamp-field.html

You should be able to achieve what you need just by adding a field with type date to your data, just make sure to create the value manually before indexing. I would suggest naming the field @timestamp which seems to be the convention.

Once you add your own timestamp value, you'll be able see the data in Discover.


(Scott) #3

Ok bummer that adds overhead I was trying to avoid. I was hoping there was an auto time going forward. I tried using the date also but couldn't get it to work correctly. I'll try it with the @timestamp and see if that helps.


(Scott) #4

Thank Tim. The @timestamp worked perfectly.

bodyStr := "{"mappings": {"" + typeName + "": {"properties": {"@timestamp": {"type": "date","format": "yyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"}}}}}"

Then I slide epoch time stamps into the JSON.


(system) #5