# Max aggregation adding decimals

**URL:** <https://discuss.elastic.co/t/max-aggregation-adding-decimals/192002>\
**Category:** Elasticsearch\
**Created:** [July 24, 2019, 10:11am UTC](https://discuss.elastic.co/t/max-aggregation-adding-decimals/192002 "2019-07-24T10:11:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anabella\_Cristaldi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anabella_cristaldi/32/23612_2.png) [@Anabella\_Cristaldi](https://discuss.elastic.co/u/Anabella_Cristaldi)\
**Post date:** [July 24, 2019, 10:11am UTC](https://discuss.elastic.co/t/max-aggregation-adding-decimals/192002/1 "2019-07-24T10:11:32Z")

</div>

Hi,  
I'm doing a very simple aggregation, but I do not understand the results  
I have 4 documents with a numeric field value called risk\_score with values 0, 5, 4 and 6.4  
When I perform a max aggregation

```
GET index-2019-07/_search
{
  "size":0,
  "query": {
    "term": {
      "asset": {
        "value": "IBM_server"
      }
    }
  }, "aggs" : {
        "max_risk" : { "max" : { "field" : "risk_score" } }
    }
  }

```

I get the following value

```
    {
      "took" : 0,
      "timed_out" : false,
      "_shards" : {
        "total" : 1,
        "successful" : 1,
        "skipped" : 0,
        "failed" : 0
      },
      "hits" : {
        "total" : {
          "value" : 4,
          "relation" : "eq"
        },
        "max_score" : null,
        "hits" : []
      },
      "aggregations" : {
        "max_risk" : {
          "value" : 6.400000095367432
        }
      }
    }

```

Is it correct that returns 6.400000095367432 instead of returning 6.4?

I put some script in the table I need to display the value (using an script i n the JSON input) in order to round, but I would linke to understand why is displaying such a value

Thank you  
Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 21, 2019, 10:36am UTC](https://discuss.elastic.co/t/max-aggregation-adding-decimals/192002/3 "2019-08-21T10:36:55Z")

</div>

Closed on August 21, 2019, 10:36am UTC

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