I met a problem when I want to add one datetime string into Elasticsearch.
The document is below:
{"LastUpdate" : "2013/07/24 00:00:00"}
This document raised an error which is "NumberFormatException" [For input string: \"20130724 00:00:00\"]
I know that I can use the Date Format in Elasticsearch, but I don't know how to use even I read the document on the website.
{"LastUpdate": { "properties": { "type": "date", "format": "yyyy-MM-dd"} } }
and
{"LastUpdate": { "type": "date", "format": "yyyy-MM-dd" } }
are wrong.
How can I transfer the datetime string into date format in Elasticsearch?
How can I store the datetime string directly into Elasticsearch?
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"). parse(doc['LAST_ORDER']. value). getTime();
Advanced Settingsedit. Advanced Settings control the behavior of Kibana. For example, you can change the format used to display dates, specify the default data view, and set the precision for displayed decimal values. Open the main menu, then click Stack Management > Advanced Settings.
You are nearly there. Set your mapping like this:
{"LastUpdate": { "type" : "date", "format" : "yyyy/MM/dd HH:mm:ss"} }
Read the docs on the date mapping and its options and the date format parameter (one of the options to the date mapping).
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With