# Arithmetic with string

**URL:** https://discuss.elastic.co/t/arithmetic-with-string/52131
**Category:** Logstash
**Created:** [June 7, 2016, 10:19pm UTC](https://discuss.elastic.co/t/arithmetic-with-string/52131 "2016-06-07T22:19:57Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![stecino](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stecino](https://discuss.elastic.co/u/stecino)
#### Post date: [June 10, 2016, 7:44pm UTC](https://discuss.elastic.co/t/arithmetic-with-string/52131/6 "2016-06-10T19:44:09Z")

</div>

Looks like adding the field and doing a convert in single mutate is the problem. I found on this [Convert String to float failed](https://discuss.elastic.co/t/convert-string-to-float-failed/32232)

where someone was having the same type of issue. Ended up breaking up into to mutates

mutate { add\_field =\> { "Test1"=\> "%{Test}" }}  
mutate { convert =\> {"Test1"=\> "float"} }

This should be fixed.

So the resulting calculation now is as expected

```
     "Test1" => 5.34,
       "foo" => 5340.0

```

}

---

_[View the full topic](https://discuss.elastic.co/t/arithmetic-with-string/52131)._
