Using json input to get absolute (positive) number

Hi,
I have a metric that only makes sense as an absolute number.
How can I turn a -5 to 5 using json input?
Note that this doesn't work, I need the number to be positive when I get a 5 or a -5

{
"script": "_value * -1 "
}

Thanks !

1 Like

You could create a scripted field with Math.abs(doc['_value'].value)

1 Like

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