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

**URL:** https://discuss.elastic.co/t/logstash-converts-integer-value-in-scientific-notation-to-float-causing-mapping-error-in-elasticsearch/253396
**Category:** Logstash
**Created:** [October 27, 2020, 7:04am UTC](https://discuss.elastic.co/t/logstash-converts-integer-value-in-scientific-notation-to-float-causing-mapping-error-in-elasticsearch/253396 "2020-10-27T07:04:52Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [October 27, 2020, 2:57pm UTC](https://discuss.elastic.co/t/logstash-converts-integer-value-in-scientific-notation-to-float-causing-mapping-error-in-elasticsearch/253396/2 "2020-10-27T14:57:28Z")

</div>

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](https://discuss.elastic.co/t/to-exclude-around-350-fields-in-json-in-logstash/239019/6) should give you some ideas on how to do it.

---

_[View the full topic](https://discuss.elastic.co/t/logstash-converts-integer-value-in-scientific-notation-to-float-causing-mapping-error-in-elasticsearch/253396)._
