是时候用 ES 拯救发际线啦

ES update_by_query 修改部分字段,修改结果为0是为什么?

Elasticsearch | 作者 lingxiao | 发布于2020年09月24日 | 阅读数:1986

POST commodity_index_test/_update_by_query
{
  "script": {
    "source": "ctx._source.fTypes=params.fTypes;ctx._source.sTypes=params.sTypes;ctx._source.tTypes=params.tTypes",
    "type": "inline",
    "lang": "painless",
    "params": {
      "fTypes": [
        {
          "name": "测试1",
          "id": "e10cdf06496841af95648f5920964329"
        }
      ],
      "sTypes": [
        {
          "name": "测试2",
          "id": "e10cdf06496841af95648f5920964329"
        }
      ],
      "tTypes": [
        {
          "name": "测试3",
          "id": "e10cdf06496841af95648f5920964329"
        }
      ]
    }
  },
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "commodityId": {
              "value": "1667120617927737346"
            }
          }
        }
      ]
    }
  }
}
 
如上语句,使用javaCient实现,在本地连接线上ES库,更新成功,但在线上环境执行update返回的数量为0 ;一摸一样的代码环境也一样,从日志中获取的参数组装成的语句如上,都能执行成功, 就是在线上执行时update 返回0 ,ES版本为7.4请大神指点!!!
已邀请:

要回复问题请先登录注册