# Define format/type of specific number fields

**URL:** https://discuss.elastic.co/t/define-format-type-of-specific-number-fields/185229
**Category:** Logstash
**Created:** [June 11, 2019, 3:28pm UTC](https://discuss.elastic.co/t/define-format-type-of-specific-number-fields/185229 "2019-06-11T15:28:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![GitsBdr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gitsbdr/32/58828_2.png) [@GitsBdr](https://discuss.elastic.co/u/GitsBdr)
#### Post date: [June 11, 2019, 3:28pm UTC](https://discuss.elastic.co/t/define-format-type-of-specific-number-fields/185229/1 "2019-06-11T15:28:26Z")

</div>

Hi here,

Thanks in advance to take the time to read it and I hope help me out.  
I'm using a logstash filter with a ruby code to subtract two fields and create a 3rd one.  
Like below :  
input { jdbc { db details [...] } }

filter { ruby { code =\> "  
event.set('f3', (event.get('f1').nil? || event.get('f2').nil?) ? nil : event.get('f2')-event.get('f1'))  
" } } }

output { elasticsearch { elastic details [...] } } }

It seems to work because I don't get any warning in my logstash log file.  
But it doesn't because values for f1 and f2 are sometimes slightly different than the ones in my database for example :  
for f1 = 1.362444 / f2 = 1.361873 I've got in Kibana f1=f2=1.362 (so rounded by default 3 digits)  
for f1 = 1.1404912 / f2 = 1.1404054 I've got in Kibana f1=f2=1.14 (so rounded by default 2 digits)  
but I have also few examples that are working well like :  
for f1 = 3262.59 / f2 = 3256.84, I have the same in Kibana

Can someone explain me how elastic works about the default field type picked up and where comes this rounded thing by default from.  
I potentially need 7 digits as decimals  
Thanks  
Guillaume

---

<div class="post-metadata">

### Author: ![GitsBdr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gitsbdr/32/58828_2.png) [@GitsBdr](https://discuss.elastic.co/u/GitsBdr)
#### Post date: [June 11, 2019, 3:50pm UTC](https://discuss.elastic.co/t/define-format-type-of-specific-number-fields/185229/2 "2019-06-11T15:50:26Z")

</div>

Sorry,  
Just figured out what I am doing wrong here...

Just posting the "solution" here  
If you are looking at the values from the "discover" panel you'll see only 2 or 3 digits but if you open a specific row and check the json code, you got all the digits your number has  
Sorry for opening this useless topic  
Regards

---

<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: [June 11, 2019, 4:11pm UTC](https://discuss.elastic.co/t/define-format-type-of-specific-number-fields/185229/3 "2019-06-11T16:11:35Z")

</div>

See [here](https://discuss.elastic.co/t/kibana-4-1-metric-visualization-round-decimal-value/24098/2) for how to change the display from the 3 digit default.

---

<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: [July 9, 2019, 4:11pm UTC](https://discuss.elastic.co/t/define-format-type-of-specific-number-fields/185229/4 "2019-07-09T16:11:43Z")

</div>

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