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"
        }
      }
    }'
  • 相关阅读:
    面试1
    初级算法-数组1
    程序员常用单词
    SpringBoot
    JDBC
    animate.css 实现 网页滚动指定位置添加动画
    解决打包上线缓存问题
    组件之间双向绑定
    按照给定数组排序原数组
    扩展运算符... 的使用
  • 原文地址:https://www.cnblogs.com/hixiaowei/p/12326986.html
Copyright © 2011-2022 走看看