Logstash Plugin error: When I use double as datatype in mutate filter


(Rahul Nama) #1

Hello

Below are the series of values i'm indexing with logstash.

0.00483871, 0.003225806, 0.006451613, 0.008064516

I'm converting it to float using mutate filter. But in kibana I see values as 0.004, 0.003, 0.006 etc.

However, I don't want to round-off the values as it's showing a considerable difference.

what should I add for not to round-off the values. using double didn't work either

Please suggest :slight_smile:


(Rahul Nama) #2

I've also tried converting it to double. but resulted in logstash plugin error.
this is the one I've used.

mutate {convert => ["UsageQuantity","double"]}


(Dheeraj Gupta) #3

Can you inspect the mapping of your elasticsearch index to see how is the float being stored in your index? How does the field mapping look in kibana (under management?)


(Rahul Nama) #4

Hello @Dheeraj_Gupta

In Kibana Mappings I see it as float.

Also, If you have any idea let me know When I use double why logstash is resulting error?


(Dheeraj Gupta) #5

Hi,

Kibana only has the "number" umbrella field that encompasses int, long, float, double types. It doesn't have an "explicit" float type. First of all you need to look at how the field is stored in your elasticsearch index. This can be done using mapping API

curl -X GET "localhost:9200/YOURINDEX/_mapping?pretty=true"

I think your field is being stored correctly as float.

Then you have to look at how kibana interprets this field.

In kibana app go to Management->Index Patterns and click on your index pattern. Search for your field and you should see its type is "number".

By default kibana shows numbers to three decimal places. You can change that by configuring the numerical field formatters. Move mouse over your field (in the same index pattern window under management) and click on edit. Change the format from Default to Number. It will show a default format of 0,0.[000]. You can add more zeroes in the [] to increase the precision. E.g. 0,0.[000000] will display floats with precision of 6 decimal places.

As for the conversion issue. According to the docs valid conversion targets are:

integer, float, integer_eu, float_eu, string, and boolean.


(Rahul Nama) #6

yes it worked. changed from default to Number and increased the precision in kibana.

Thank you so much :):smiley:@Dheeraj_Gupta


(system) #7

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