# Painless converts float to integer

**URL:** <https://discuss.elastic.co/t/painless-converts-float-to-integer/148414>\
**Category:** Kibana\
**Created:** [September 13, 2018, 6:57am UTC](https://discuss.elastic.co/t/painless-converts-float-to-integer/148414 "2018-09-13T06:57:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jerzy\_Stopa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerzy_stopa/32/31842_2.png) [@Jerzy\_Stopa](https://discuss.elastic.co/u/Jerzy_Stopa)\
**Post date:** [September 13, 2018, 6:57am UTC](https://discuss.elastic.co/t/painless-converts-float-to-integer/148414/1 "2018-09-13T06:57:32Z")

</div>

I have field 'payload.temperature[c]' in one of the indexes. I cannot use it in Timelion due to [] therefore I created simple scripted field Temp defined as follows:`return doc['payload.temperature[c]'].value`

But instead of getting same value (float) I get integer

```
> Time payload.temperature[c] Temp      
> 2018-09-13 08:36:00 31.1 31
> 2018-09-13 08:35:57 6.5 6
> 2018-09-13 08:35:00 31.3 31
> 2018-09-13 08:34:57 6.6 6

```

Scripted field has type number and format number/default. Any help?

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [September 13, 2018, 4:20pm UTC](https://discuss.elastic.co/t/painless-converts-float-to-integer/148414/2 "2018-09-13T16:20:43Z")

</div>

Hmm, strange, painless should support floats just fine. Can you share elasticsearch mappings for payload.temperature?

The number format is the browser's interpretation of it, and javascript isn't too picky about decimals so I don't think it should be doing anything.

---

<div class="post-metadata">

**Author:** ![Jerzy\_Stopa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerzy_stopa/32/31842_2.png) [@Jerzy\_Stopa](https://discuss.elastic.co/u/Jerzy_Stopa)\
**Post date:** [September 15, 2018, 9:16am UTC](https://discuss.elastic.co/t/painless-converts-float-to-integer/148414/3 "2018-09-15T09:16:35Z")

</div>

You are right, there is something wrong in mappings. with field show once as long and once as text.  
I am confuse of how it happened. Will try to correct, reindex and hope problem will disappear.  
Thank you for suggestion

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 13, 2018, 9:30am UTC](https://discuss.elastic.co/t/painless-converts-float-to-integer/148414/4 "2018-10-13T09:30:17Z")

</div>

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