找到问题的解决办法了么?

es聚合后返回的数据精度和格式问题?

Elasticsearch | 作者 zhaohao | 发布于2018年03月22日 | 阅读数:9292

插入的数据,maping中size默认就是long
curl -XPOST '192.168.2.58:9200/test_index1/test_type1/_bulk?pretty' -H 'Content-Type: application/json' -d'
{ "index": {}}
{ "size" : 12345678901234567}
'
聚合
curl -XPOST "http://192.168.2.58:9200/test_index1/_search" -H 'Content-Type: application/json' -d'
{
  "aggregations": {
    "total_obj_size": {
      "sum": {
        "field": "size"
      }
    }
  },
  "size": 0
}'
结果
{
    "took": 1,
    "timed_out": false,
    "_shards": {
        "total": 6,
        "successful": 6,
        "failed": 0
    },
    "hits": {
        "total": 1,
        "max_score": 0.0,
        "hits": []
    },
    "aggregations": {
        "total_obj_size": {
            "value": 1.2345678901234568E16
        }
    }
}
size存储的数据不是long型的吗,为什么返回的数据使用科学计数法返回的?
返回的数据好像是用double类型,精度都不够了?
已邀请:

rockybean - Elastic Certified Engineer, ElasticStack Fans,公众号:ElasticTalk

赞同来自:

我这边没有复现,是6.0的版本,在 kibana devtools console 里面测试的,输出结果正常
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0,
"hits": []
},
"aggregations": {
"total_obj_size": {
"value": 24691357802469136
}
}
}

要回复问题请先登录注册