I have many fields generated from the kv plugin like so:
kv {
source => "kvpairs"
remove_field => [ "kvpairs" ]
}
I have tried both of the following and neither result in the fields being converted to their proper types.
#iterate through each key and attribute types via convetion
ruby {
code => "
event.to_hash.each { |k, v|
event[k] = v.to_f if k.end_with? '_f'
event[k] = v.to_i if k.end_with? '_i'
}
"
}
After this failed, the new fields were indexed as String, I tried to manually convert them with the mutate plugin like this:
#debugging: instead manually convert field type with mutate plugin
mutate {
convert => {
"duration_f" => "float"
"order_lines_i" => "integer"
}
}
After this, I saw that the duration_f and order_lines_i fields were now 'unknown'. After I refreshed the index through Kibana 'refresh field list' button, I then saw that they were both indexed as strings. Any help is appreciated, thank you.