Kibana painless- Difference in dates in days

I have two date fields - Date1 and Date2, both are in date format
I want to calculate days between the two dates.
I tried doc['date2'].value - doc['date1'].value, this is not giving the expected return value

You could do something like the following:

return (doc['date2'].value.millis - doc['date1'].value.millis) / 1000 / 60 / 60 / 24;

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