# ScriptedField - Only part before comma is taken

**URL:** <https://discuss.elastic.co/t/scriptedfield-only-part-before-comma-is-taken/85885>\
**Category:** Kibana\
**Created:** [May 16, 2017, 9:01am UTC](https://discuss.elastic.co/t/scriptedfield-only-part-before-comma-is-taken/85885 "2017-05-16T09:01:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![th\_dap7](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@th\_dap7](https://discuss.elastic.co/u/th_dap7)\
**Post date:** [May 16, 2017, 9:01am UTC](https://discuss.elastic.co/t/scriptedfield-only-part-before-comma-is-taken/85885/1 "2017-05-16T09:01:47Z")

</div>

I added a scripted field to my index with name Drift using painless:  
Name Language Script  
Drift painless doc['NumberValue'].value

The attribute NumberValue has float values. The scripted field shows only the part before the comma  
 ![](https://us1.discourse-cdn.com/elastic/original/3X/6/4/64fd4d89fd1f3825e64364e302a6394662873db8.png)  
When I do the same with another float attribute the scripted field shows the hole float number.  
How can I troubleshoot this error?

Thank you for your support

---

<div class="post-metadata">

**Author:** ![Stacey\_Gammon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stacey_gammon/32/14025_2.png) [@Stacey\_Gammon](https://discuss.elastic.co/u/Stacey_Gammon)\
**Post date:** [May 16, 2017, 4:00pm UTC](https://discuss.elastic.co/t/scriptedfield-only-part-before-comma-is-taken/85885/2 "2017-05-16T16:00:21Z")

</div>

Strange. What does your number format look like? It should work with the default, but if not, perhaps try specifying the Number format and make sure there are 0's after the decimal point.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/2/1/21a287867627c08617e3f82458d5a098b54bfaaf.png)

---

<div class="post-metadata">

**Author:** ![th\_dap7](https://avatars.discourse-cdn.com/v4/letter/t/a698b9/32.png) [@th\_dap7](https://discuss.elastic.co/u/th_dap7)\
**Post date:** [May 17, 2017, 6:27am UTC](https://discuss.elastic.co/t/scriptedfield-only-part-before-comma-is-taken/85885/3 "2017-05-17T06:27:04Z")

</div>

Hi Stacey,  
thank you for your answer.

I already tried this but still I have the problem  
Drift and NumberValue are both defined as Number with below Format

 ![](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5da8cd407f6732155ef955f2b2ab177bf255d65e.png)

---

<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:** [June 14, 2017, 6:27am UTC](https://discuss.elastic.co/t/scriptedfield-only-part-before-comma-is-taken/85885/4 "2017-06-14T06:27:05Z")

</div>

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