ElasticSearch: Get duration between two fields script syntax error

后端 未结 1 1636
抹茶落季
抹茶落季 2020-12-22 08:19

I\'ve created this script in order to get a date difference between two fields:

use(groovy.time.TimeCategory) {
    def duration = doc[firstDateField].date -         


        
1条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-22 08:31

    You can use another script that doesn't make use of the JODA Period class

    Update your script file with this and that'll work:

    (doc[secondDateField].date.millis - doc[firstDateField].date.millis) / 3600000
    

    0 讨论(0)
提交回复
热议问题