# Strange output number from elasticsearch with scaled\_float datatype

**URL:** <https://discuss.elastic.co/t/strange-output-number-from-elasticsearch-with-scaled-float-datatype/207953>\
**Category:** Elasticsearch\
**Created:** [November 14, 2019, 7:18pm UTC](https://discuss.elastic.co/t/strange-output-number-from-elasticsearch-with-scaled-float-datatype/207953 "2019-11-14T19:18:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![allanforms](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@allanforms](https://discuss.elastic.co/u/allanforms)\
**Post date:** [November 14, 2019, 7:18pm UTC](https://discuss.elastic.co/t/strange-output-number-from-elasticsearch-with-scaled-float-datatype/207953/1 "2019-11-14T19:18:34Z")

</div>

Hi there.  
A friend is having trouble to output the result of a sum aggregation properly.  
We tried to format the field in Kibana so the output in the visualization would shown formatted, but it still kept returning oddly formatted.  
Here is our test.

```
PUT /teste_indice_sum_nome
{
    "settings" : {
        "number_of_shards" : 1
    },
    "mappings" : {
        "properties" : {
            "testcalc": {
              "type": "scaled_float",
              "scaling_factor": 100
            }
        }
    }
}

POST teste_indice_sum_nome/_bulk
{ "index" : { "_id" : 1 } }
{ "testcalc" : 0.0 }
{ "index" : { "_id" : 2 } }
{ "testcalc" : 18382.26 }
{ "index" : { "_id" : 3 } }
{ "testcalc" : -808560.25 }
{ "index" : { "_id" : 4 } }
{ "testcalc" : 131606.72 }
{ "index" : { "_id" : 5 } }
{ "testcalc" : 5576474.22 }
{ "index" : { "_id" : 6 } }
{ "testcalc" : -110617.43 }
{ "index" : { "_id" : 7 } }
{ "testcalc" : 14002.85 }
{ "index" : { "_id" : 8 } }
{ "testcalc" : -136577.68 }
{ "index" : { "_id" : 9 } }
{ "testcalc" : 104506.85 }
{ "index" : { "_id" : 10 } }
{ "testcalc" : -4357917.55 }
{ "index" : { "_id" : 11 } }
{ "testcalc" : -431299.99 }
{ "index" : { "_id" : 12 } }
{ "testcalc" : 0 }

GET teste_indice_sum_nome/_search?pretty=true
{
  "aggs": {
    "TESTANDO": {
      "sum": {
          "field": "testcalc"
          
      }
    }
  }
  ,"size": 0
}
```

---

<div class="post-metadata">

**Author:** ![allanforms](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@allanforms](https://discuss.elastic.co/u/allanforms)\
**Post date:** [December 3, 2019, 1:25pm UTC](https://discuss.elastic.co/t/strange-output-number-from-elasticsearch-with-scaled-float-datatype/207953/2 "2019-12-03T13:25:53Z")

</div>

It's returning 2.3,283,064,365,386,963e-10 for the sum of the field, even if Kibana number format is set to show 2 or 3 decimal digits.

---

<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:** [December 31, 2019, 1:25pm UTC](https://discuss.elastic.co/t/strange-output-number-from-elasticsearch-with-scaled-float-datatype/207953/3 "2019-12-31T13:25:58Z")

</div>

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