Open talvey opened 7 years ago
Anyone else having this issue? Tried multiple java 15 versions and ELK Stacks 7.12.x/7.13.0 combinations, but when using mutate { convert => { ["field"] => "string"}}
I get the same results with 11.11 => "0.1111e2".
mutate { add_field => { "placeholder" => "%{float_number}"} } mutate { convert => ["float_number","string"]} ruby { code => ' event.set("float_number", event.get("placeholder").slice(0..-3)) '} mutate { remove_field => [ "placeholder" ] }
My temporary workaround, if anyone has a fix or better solution any help is greatly appreciated.
Given a JSON message with a decimal field value, converting that target value to a string will result in scientific "E" notation. While this isn't exactly a bug, I'd call it an unexpected result.
To recreate, pass the following simple JSON document to logstash
And then use the following filter section
The result is
"decimal1" => "0.51E1"
My guess -- the cause is the underlying java json parsing library defaulting decimal fields to Java BigDecimal, which gets translated to a Ruby BigDecimal -- calling to_s on the Ruby BigDecimal yields the "0.51E1".