【发布时间】:2021-01-13 13:56:49
【问题描述】:
我正在尝试获取两个日期的毫秒值并将它们减去另一个日期。
当我像doc['begin_time'].value.toInstant().toEpochMilli() 一样使用ctx._sourse.begin_time.toInstant().toEpochMilli() 时,它给了我运行时错误。
和ctx._source.begin_time.date.getYear()(像这样Update all documents of Elastic Search using existing column value)给我运行时错误消息
"ctx._source.work_time = ctx._source.begin_time.date.getYear()",
" ^---- HERE"
如果此代码正常工作doc['begin_time'].value.toInstant().toEpochMilli(),我会得到什么类型的ctx._source。
我无法在无痛的文档中找到如何正确获取值。 begin_time 是日期 100%。
那么,如何编写脚本来获取两个日期之间的差异并将其写入另一个整数?
【问题讨论】:
标签: elasticsearch elasticsearch-painless