My current date format is "2019-11-11T05:59:12.000Z" and I want to modify this with day_of_the_week. I tried to achieve it by utilising painless script but it forces me to use terms as an aggregation without mentioning date.
I need date format should be changed to this format as Mon 2019-11-11T05:59:12.000Z. I also tried painless script examples from Elasticsearch documentation but always I started and ended up with following error as "Cannot cast org.elasticsearch.script.JodaCompatibleZonedDateTime to java.time.ZonedDateTime"
I used following script copied from documentation.
ZonedDateTime input = doc['order.date'].value; String output = input.format(DateTimeFormatter.ISO_INSTANT);
I had also tried to add two fields to construct my own format as shown below but I got an error as
["", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][doc['order.date'].value.dayOfWeek] + [doc['order.date'].value]
please help to achive this.