I\'ve created this script in order to get a date difference between two fields:
use(groovy.time.TimeCategory) { def duration = doc[firstDateField].date -
You can use another script that doesn't make use of the JODA Period class
Period
Update your script file with this and that'll work:
(doc[secondDateField].date.millis - doc[firstDateField].date.millis) / 3600000