es 数组追加


POST test_index/test_type/1/_update
{
   "script" : {
       "inline": "ctx._source.tags.add(params.new_tag)",
       "params" : {
          "new_tag" : "tag4"
       }
   }
}

 增加字段

awemeuser/_mapping 
{
  "properties": {
    "total_pro_share": {
      "type": "long"
    },
    "total_pro_comment": {
      "type": "long"
    },
    "total_pro_favorite": {
      "type": "long"
    }
  }
}

设置默认值

http://localhost:9200/awemeuser/_update_by_query
{
  "script": {
    "lang": "painless",
    "source": "if (ctx._source.total_pro_share== null) {ctx._source.total_pro_share= 0}"
  }
}

 修改副本数 put

http://localhost:9200/awemeincr202107/_settings
{"number_of_replicas":0}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM