I have string fields in my index like
"repliedTs": "2018-12-27T10:58:28.423-05:00",
"receivedTs": "2018-12-27T10:58:27.168-05:00"
i am trying to write kibana painless script to convert string type to date and find the difference, but could not get success. could please help me
here is my code...
(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S").parse(doc['repliedTs'].value).getTime()) - (new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S").parse(doc['receivedTs'].value).getTime())
These fields would be dynamically mapped to date type by ES. Try:
doc['repliedTs'].value.millis - doc['receivedTs'].value.millis
This will retrieve the difference in milliseconds.
Thanks for reply jen-Huang,
I tried as you suggested but not working
doc['repliedTs'].value.millis - doc['receivedTs'].value.millis
Is there any other way to convert string to date?
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.