Numbers below zero indexed as text

When indexing data with numbers below zero the fields get classified as text instead of numbers. Now I cannot make value based graphs in Timelion.

This json object is indexed correctly:
{"sensorId": 1, "values": {"gyro_z": " 0.002", "acc_x": " 0.172", "acc_z": " 9.807", "gyro_y": " 0.000", "gyro_x": " 0.000", "acc_y": " 0.115"}, "sensorName": "Phone sensor", "timestamp": "2018-05-31 13:05:36.650602"}

However, when starting an idex with sub zero numbers they all become strings. Like this:
{"sensorId": 1, "values": {"gyro_z": "-1.396", "acc_x": " 0.211", "acc_z": " 9.922", "gyro_y": "-2.955", "gyro_x": " 0.507", "acc_y": " 0.000"}, "sensorName": "Phone sensor", "timestamp": "2018-05-31 13:06:02.303910"}

my config file:
input
{
udp {
id => "My_UDP_ID"
port => 8085
}
}

filter
{
json {
source => "message"
}
mutate{
remove_field => ["message"]
}

}

output
{
elasticsearch {
hosts => ["http://localhost:9200"]
index => "newstream"
document_type => "android_data"
}
stdout {
codec => rubydebug
}
}

Well, technically they are strings as far as the JSON goes. I suggest you convert those fields to numbers with mutate filter.

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