We are trying to visualize some data based on a timespan between two dates date1 and date2. I'm trying to create a scripted field to return the amount of days between the two dates. This works as expected however date2 can in certain cases be in the future in which case we need to use the span between date1 and current time.
Expression I would like to run:
doc['date2'].value < now) ? doc['date2'] - doc['date1'] : now - doc['date1']
I cannot find any way to access current time in a scripted field expression. Is this possible?
We are running Kibana 4.5.0