试试搜索一下吧

对数字类型多条件term报错NumberFormatException

Elasticsearch | 作者 Acerleef | 发布于2018年01月05日 | 阅读数:10279

在ES里执行如下Query的时候报错:
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "orderSubType": {
              "value": [
                0,
                1,
                2
              ],
              "boost": 1
            }
          }
        }
      ]
    }
  }
}

错误如下:
{"error": {

"root_cause": [

{

"type": "query_shard_exception",
"reason": "failed to create query: { "bool" : { "filter" : [ { "term" : { "orderSubType" : { "value" : "]", "boost" : 1.0 } } } ], "disable_coord" : false, "adjust_pure_negative" : true, "boost" : 1.0 } }",
"index_uuid": "yU0cvLLuRlOeQK6YwaFB8Q",
"index": "bill-201710"

}

],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [

{

"shard": 0,
"index": "bill-201710",
"node": "CoiI4HDiSX2UzwodVW5vyA",
"reason": {

"type": "query_shard_exception",
"reason": "failed to create query: { "bool" : { "filter" : [ { "term" : { "orderSubType" : { "value" : "]", "boost" : 1.0 } } } ], "disable_coord" : false, "adjust_pure_negative" : true, "boost" : 1.0 } }",
"index_uuid": "yU0cvLLuRlOeQK6YwaFB8Q",
"index": "bill-201710",
"caused_by": {

"type": "number_format_exception",
"reason": "For input string: "]""

}

}

}

],
"caused_by": {

"type": "query_shard_exception",
"reason": "failed to create query: { "bool" : { "filter" : [ { "term" : { "orderSubType" : { "value" : "]", "boost" : 1.0 } } } ], "disable_coord" : false, "adjust_pure_negative" : true, "boost" : 1.0 } }",
"index_uuid": "yU0cvLLuRlOeQK6YwaFB8Q",
"index": "bill-201710",
"caused_by": {

"type": "number_format_exception",
"reason": "For input string: "]""

}

}

},
"status": 400}
从Java里的报错来看,reason字段是“For input string: "[0, 1, 2]"];”

查了一圈也没有看出来为什么这里会有问题,请问哪位知道这个怎么破
已邀请:

Judge

赞同来自: rojay

用terms

要回复问题请先登录注册