我试图在Kibana 4.5.1中编写一个脚本化字段,以便从@timestampt
字段中提取小时。我只是按照以下链接中的示例进行操作,但是它给了我一个解析错误:
https://www.elastic.co/blog/kibana-4-beta-3-now-more-filtery
现在在链接中说,这从Kibana 4.0.0开始不起作用,因为脚本字段现在基于Lucene。那么有人知道Lucene中的等效代码是什么吗? Groovy表达式如下:Integer.parseInt(new Date(doc["@timestamp"].value).format("H"))
其中@timestamp
是字段名称,其中包含格式为MMM dd HH:mm:ss.SSS
的日期,我需要提取HH
值。
最佳答案
他们现在使用lucene表达:doc["creation_ts"].getHourOfDay()
https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-scripting.html#_lucene_expressions_scripts
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_lucene_expressions_scripts
关于elasticsearch - Kibana脚本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39525762/