Small values getting rounded to zero on scripted field

Hi folks, This one's got me stumped... I'm taking a really small value, and creating a scripted field to scale it, so that kibana can chart it nicely for me. But I'm losing precion somewhere and ending up with '0' instead of a scaled number.

Scripted field is pretty simple...

'GET Index-*/_search
{
"script_fields": {
"fields.ActualValue.mAmp": {
"script": {
"lang": "expression",
"inline": "doc['fields.ActualValue.SIValue'].value *1000000"
}
}
}
}'

The number I want to scale is pretty small, e.g. 0.00000492712
In the image, you can see the scaled scripted variable fields.ActualValue.mAmp
scale%20problem

Obviously, when I chart this I get a flat line at zero.

Running the scripted field in Console - it works on any values that are greater than one, but appears to treat them as integers. Here's a sample output
{
"_index": "Index-2018.03",
"_type": "logevent",
"_id": "AWJBHnfFKawtLpEL6hQe",
"_score": 1,
"fields": {
"NewActualValue": [
0
]
}
},
{
"_index": "Index-2018.03",
"_type": "logevent",
"_id": "AWJBHnfFKawtLpEL6hQi",
"_score": 1,
"fields": {
"NewActualValue": [
14000000
]
}
}

Further to this the original field is mapped as a Long. So I don't know where I'm losing precision.

Any pointers for diagnosing or solving this issue, are greatly appreciated.

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