# Convert string to integer

**URL:** https://discuss.elastic.co/t/convert-string-to-integer/277915
**Category:** Kibana
**Created:** [July 6, 2021, 6:44am UTC](https://discuss.elastic.co/t/convert-string-to-integer/277915 "2021-07-06T06:44:26Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![ANKITA\_SAHA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankita_saha/32/91152_2.png) [@ANKITA\_SAHA](https://discuss.elastic.co/u/ANKITA_SAHA)
#### Post date: [July 9, 2021, 4:31pm UTC](https://discuss.elastic.co/t/convert-string-to-integer/277915/4 "2021-07-09T16:31:07Z")

</div>

> [@Fix x-axis in Kibana 7.13.2](https://discuss.elastic.co/t/fix-x-axis-in-kibana-7-13-2/277918/9):
>
> Check out runtime fields in the Lens UI instead of stack management (it's newer as of 7.13) - [Lens | Kibana Guide [7.13] | Elastic](https://www.elastic.co/guide/en/kibana/current/lens.html#add-fields-in-lens)
> 
> You can add a script that converts the field to the appropriate data type. Really, though, if this works for you it's more performant to index the appropriate type up front (runtime fields are slower than indexed fields).
> 
> Here's an example that does the opposite of what you're trying to do. The example uses painless which exposes a lot of useful java APIs.
> 
> ```auto
> Long input = doc['event.duration'].value;
> String output = Objects.toString(input);
> 
> emit(output);
> 
> ```

Thank you @ghudgins for the solution 😀

---

_[View the full topic](https://discuss.elastic.co/t/convert-string-to-integer/277915)._
