Add numeric field

Hi,
i simply want to create a new numeric field.
But when using "add-field" command i get systematically a string !
My logstash filter code like :
....
mutate { add_field => { "launcher.%{company}" => "%{count_comp}"} }
mutate { convert => ["launcher.%{company}","float_eu"] }
....

I tried with type "integer" but it's the same result.

Expected result in es is :

"launcher.ABC" = "12.10"
"launcher.DEF" = "33.00"

Where is my mistake ?
Thanks

add_field always adds strings. You can use mutate+convert to change it to a number. Note that convert gets executed before add_field, so it has to be a separate mutate filter.

Thanks Badger,
but that does not solve the problem (logstash 6.8). I don't understand...

Finally, I mapped the field directly in es before running Logstash. That solved the problem.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.