zoukankan      html  css  js  c++  java
  • elasticsearch字段属性值截断为32位

    1.问题:ES中数据长度过长,表字段的长度 没那么长, 保存不了数据,导致报错

    2.解决方案:将ES中orgId=2efc32ee89074e919afa2219e3cace53的租户数据中,personName属性值截断为32位。
      1、索引名:addressbook_user  
      2、查询条件:orgId=2efc32ee89074e919afa2219e3cace53)
      3、es操作环境:develop开发环境

    3.32位

    curl -XPOST "http://10.0.0.42:900/addressbook_user/wxqyh/_update_by_query" -H 'Content-Type: application/json' -d'
    {
      "script": {
        "source": "ctx._source["personName"]=ctx._source["personName"].length()>32?ctx._source["personName"].substring(0,32):ctx._source["personName"];"
      },
      "query": {
        "term": {
          "orgId": "2efc32ee89074e919afa2219e3cace53"
        }
      }
    }'

     4.20位

    curl -XPOST "http://10.0.0.42:9200/addressbook_user/wxqyh/_update_by_query" -H 'Content-Type: application/json' -d'
    {
      "script": {
        "source": "ctx._source["personName"]=ctx._source["personName"].length()>20?ctx._source["personName"].substring(0,20):ctx._source["personName"];"
      },
      "query": {
        "term": {
          "orgId": "2efc32ee89074e919afa2219e3cace53"
        }
      }
    }'
  • 相关阅读:
    Spiral Matrix II
    N-Queens
    Jump Game II
    js改变div高度
    Jenkins + testNg + maven 项目持续集成
    bootstrap做的导航
    bootstrap左侧边栏
    WEB-INF下jsp跳转
    jsp页面无法解析EL表达式
    springMVC和mybatis整合,jsp对时间进行格式化
  • 原文地址:https://www.cnblogs.com/hixiaowei/p/12326986.html
Copyright © 2011-2022 走看看