Strange output number from elasticsearch with scaled_float datatype

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
}

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.

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