elasticsearch索引读写状态设置

elasticsearch索引读写状态设置

index读写状态设置

PUT /news/_settings
{
  "index.blocks.read_only":false,
  "index.blocks.write":true
}

POST /news/_close

POST /news/_open

别名设置

POST /_aliases
{
  "actions": [
    {
      "add": {
        "index": "new_1",
        "alias": "niuniu",
          "is_write_index": true
      }
    },{
      "add": {
        "index": "news",
        "alias": "niuniu",
          "is_write_index": false
      }
    }
  ]
}

删除别名

POST /_aliases
{
  "actions": [
    {
      "remove": {
        "index": "new_1",
        "alias": "niuniu"
      }
    },{
      "remove": {
        "index": "news",
        "alias": "niuniu"
      }
    }
  ]
}

 

 

PUT /new_1
{
  "settings": {
    "number_of_shards": "5",
    "max_result_window": "100000000",
    "number_of_replicas": "1"
  },
  "mappings": {}
}