Logstash converts integer value in scientific notation to float, causing mapping error in Elasticsearch

You could try

    ruby {
        code => '
            event.to_hash.each { |k, v|
                if v.is_a? Float
                    if v.to_i.to_f == v
                        event.set(k, v.to_i)
                    end
                end
            }
        '
    }

If you need to iterate into nested objects then this should give you some ideas on how to do it.