Hi all - I have a metric in my index that is in java.util.Date milliseconds, like this -> 1,547,659,500,000
I want to convert this to a date format like this -> January 16th 2019, 09:28:05.150
Can I do this with a painless script? If yes, how?
Hi all - I have a metric in my index that is in java.util.Date milliseconds, like this -> 1,547,659,500,000
I want to convert this to a date format like this -> January 16th 2019, 09:28:05.150
Can I do this with a painless script? If yes, how?
I managed to create a painless script
if (doc['StartTime'].value != null) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormat.format(new Date(doc['StartTime'].value));
}
return 0;
and this is returning ""2019-01-10T11:57:00.000Z" but Kibana is still complaining with an "Unsupported script value" error. Any ideas why?
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.