I want to add a scripted field to calculate the difference between two dates - start date and end date. However, the format of them is a little bit different. Here's how they look like:
proc_start_time: 04:10:26
proc_end_time: 04:10:29
I want to add another field called proc_time which will calculate the difference between these two fields.
I've gone through lucene expressions and painless docs (not very good at them).
Are they saved as a date field in Elasticsearch? then it should be really easy: doc['proc_end_time'].value - doc['proc_start_time'].value will give you the value in miliseconds. If you set the custom format for the field to "Duration" you will also get a nice human readable format for that field.
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.