悟空,拿我的打狗棒来

elastic 统计 数据类型

Elasticsearch | 作者 saga | 发布于2017年09月04日 | 阅读数:4605

Expected numeric type on field 
 

对物品销售价格存库,但是price是string类型,导致无法统计
 
"aggs": {
            "chargehours": {
              "date_histogram": {
                    "field": "@timestamp",
                    "interval": "day",
                    "format": "yyyy-MM-dd"
                },
                "aggs": {
                    "payercount": {
                        "value_count": {
                            "field": "playerId.keyword"
                        }
                    },
                    "totalsum" : {
                      "sum" : {
                        "field": "price.keyword"
                      }
                    }
                }
            }
        }
请问有什么办法解决吗
已邀请:

Cheetah

赞同来自:

mapping建好之后是不能更改的,如果是5.0之前的版本的话,只能重新导数据重建索引
5.0之后稍微好一点,可以调用reindex api

要回复问题请先登录注册