Sum aggs gives scientific value as result as shown below.
Expected value 11111108.6789
Actual value : 1.1111108625E7
Index Mapping
{
"sample-tx" : {
"mappings" : {
"properties" : {
"Id" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"price" : {
"type" : "float"
},
"promotion" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"publishedDate" : {
"type" : "date"
},
"source" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"status" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"subType" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"transactionDate" : {
"type" : "date"
},
"type" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
Added below data into index
POST /_bulk
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "1" } }
{"Id" : "M-90010402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "2" } }
{"Id" : "M-90020402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "3" } }
{"Id" : "M-90030402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "4" } }
{"Id" : "M-90040402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "5" } }
{"Id" : "M-90050402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "6" } }
{"Id" : "M-90060402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "7" } }
{"Id" : "M-90070402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "8" } }
{"Id" : "M-90080402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
{ "index" : { "_index" : "sample-tx", "_type" : "_doc", "_id" : "9" } }
{"Id" : "M-90090402224464143","type" : "E","source" : "mobile", "status" : "Processed","transactionDate" : "2021-03-18T21:12:00Z","price" : "1234567.6789", "promotion" : "Test1"}
When created alert using ES query:
GET /sample-tx/_search
{
"size": 0,
"aggs": {
"total": {
"sum": {
"field": "price"
}
}
}
}
It gives results
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 9,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
},
"aggregations" : {
"total" : {
"value" : 1.1111108625E7
}
}
}
But , when I use same index to create visualization and use sum metric value is displayed correctly.
Wondering how? Is this a way to use sum metric in ES query to get correct value as shown in visualization?