本文介绍了Logstash-将字符串转换为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Logstash中,我具有以下配置:
In my Logstash I have below configuration:
filter {
mutate {
add_field => {
"doclength" => "%{size}"
}
convert => {"doclength" => "integer"}
remove_field => ["size"]
}
}
我打算将字段" doclength "作为整数存储到ElasticSearch中.但是以某种方式在ES中,它仅将映射显示为"字符串".
I intend to store the field "doclength" into ElasticSearch as an integer. But somehow in ES, it shows mapping as "string" only.
不确定我在这里缺少什么,预期的行为与实际行为不符.
Not sure what I am missing in here, the expected behavior is not matching up with the actual one.
推荐答案
尝试一下,它可以在我的机器上工作.
Try this one, it worked on my machine.
filter {
mutate {
convert => {"size" => "integer"}
rename => { "size" => "doclength" }
}
}
这篇关于Logstash-将字符串转换为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!