在es中,created_at
作为日期类型
created_at: {
type: "date",
format: "strict_date_optional_time||epoch_millis"
},
我想在script_score
计算中使用created_at作为UnixTimeStamp纪元秒。如何实现呢?
(doc['created_at'].value.to_unixtimestamp? - 1412092800)/86400.0
您有两个选择,就像这样
((doc['created_at'].value / 1000) - 1412092800)/86400.0
或像这样:
((doc['created_at'].date.millis / 1000) - 1412092800)/86400.0
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句