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}

 

posted @ 2021-06-18 09:23  今晚再打老虎  阅读(809)  评论(0编辑  收藏  举报