ES : Can't get text on a START_OBJECT at 1.225

 

ES : Can't get text on a START_OBJECT at 1.225_第1张图片

pre 环境,批量更新,遇到错误 : "Can't get text on a START_OBJECT at 1:225"

无法解析字段 pushDetail 。mapping 中 pushDetail 字段是keyword 类型,所有应该传字符串类型的数据。业务传的是 json 格式的数据,故报此错。

 

解决方案:

1、修改 pushDetail 字段 mapping 为 Object 类型 ;

2、传 字符串类型,修改更新 DSL 语句:

POST /sn_data_analysis/data_detail/_update_by_query
{
  "query": {
        "bool": {
            "must": [
                {"term": {"appCode": "SNYG"}},
{"term": {"activityId": "TEST160735"}}
            ]
        }
    },
  "script": {
    "inline": "ctx._source.pushDetail = params.pushDetail",
     "params": {
            "pushDetail": ["{\"count\":0,\"type\":1}","{\"count\":0,\"type\":2}","{\"count\":0,\"type\":3}","{\"count\":0,\"type\":4}","{\"count\":0,\"type\":5}","{\"count\":0,\"type\":6}","{\"count\":0,\"type\":7}","{\"count\":0,\"type\":8}","{\"count\":0,\"type\":21}","{\"count\":0,\"type\":9}","{\"count\":0,\"type\":10}","{\"count\":0,\"type\":11}","{\"count\":0,\"type\":12}","{\"count\":0,\"type\":13}","{\"count\":0,\"type\":14}","{\"count\":0,\"type\":19}","{\"count\":0,\"type\":20}","{\"count\":0,\"type\":15}","{\"count\":0,\"type\":17}","{\"count\":0,\"type\":16}","{\"count\":0,\"type\":18}","{\"count\":0,\"type\":22}","{\"count\":0,\"type\":25}","{\"count\":0,\"type\":26}","{\"count\":0,\"type\":27}","{\"count\":0,\"type\":28}","{\"count\":0,\"type\":29}","{\"count\":0,\"type\":30}"]
        },
    "lang": "painless"
  }
}

PS : 批量更新,不支持 doc 更新模式

你可能感兴趣的:(ElasticSearch)