ElasticSearch Facet异常处理

当facet时数据返回数字不对,或者出现异常,不做facet不报错,百思不得其解,在独立的index下建index type,facet也不报错。
QueryPhaseExecutionException[[dn][2]: query[ConstantScore(NotDeleted(cache(_type:dn_character_glory)))],from[0],size[1]: Query Failed [Failed to execute main query]]; nested: NumberFormatException[Invalid shift value in prefixCoded string (is encoded value really a LONG?


猜想跟integer数据类型有关系

后来看到ES大拿kimchy说到
When you facet on a field across index types, they need to be of the same field type (string, long). You can name the field differently.


恍然大悟, terms facet估计是为string类型设计的,如果要对integer类型做term,要不增加一个field,要不直接做成string.

因为不考虑number类型统计,这里将field直接做成string数据类型,问题解决。

[b]思考:[/b]
当建index type mapping时,要适当选择field的code type。

[b]BTW:[/b]
似乎插件head自带的any request也会有数据bug
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值