Inline script for round off float field is not working

Hi all,

I'm trying to display average of a field in visualization bucket.

But when i use below code in inline text of advanced JSON for an integer value, I dont get.
I dont want decimal values.

{
  "script": {
"inline":"Math.round(doc['DC_AMOUNT'].value * 100.0)/100.0",
    "lang": "painless"
  }
}

It works for buckets when i round off values.
But when i take an average of fields and try to implement, it does'nt work.
Any help

Inline scripts don't work for aggregations like average. If you just want to round a field, you can do that by configuring the field formatter for this field in the index pattern: Numeric field formatters | Kibana Guide [7.12] | Elastic

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