How to round a value in an aggregation query?

Hi Im trying to round the value of "forecast_prediction" in an aggs query, I have tried bucket script aggregation but is not working

"aggs": {
              "jobid": {
                "terms": {
                  "field": "job_id",
                  "order": {
                    "_key": "desc"
                  },
                  "size": 10
                },
                "aggs": {
                  "fecha": {
                    "terms": {
                      "field": "timestamp",
                      "order": {
                        "_key": "desc"
                      },
                      "size": 10
                    },
                    "aggs": {
                      "host": {
                        "terms": {
                          "field": "partition_field_value",
                          "order": {
                            "_key": "desc"
                          },
                          "size": 10
                        },
                        "aggs": {
                          "fs": {
                            "terms": {
                              "field": "by_field_value",
                              "order": {
                                "_key": "desc"
                              },
                              "size": 10
                            },
                            "aggs": {
                              "prediccion": {
                                "top_hits": {
                                  "docvalue_fields": [
                                    {
                                      "field": "forecast_prediction"
                                    }
                                  ],
                                  "_source": "forecast_prediction",
                                  "size": 1,
                                  "sort": [
                                    {
                                      "timestamp": {
                                        "order": "desc"
                                      }
                                    }
                                  ]
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            },`

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