Unsupported value - Simple Date format on Kibana

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?

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