es 索引操作

2023-09-19  本文已影响0人  刘勇_leo

1. 新建索引

PUT /xxx
{
  "settings": {
    "number_of_shards": 4,
    "number_of_replicas": 1
  },
  "mappings": {
    "_doc": {
      "properties": {
        "activityFinishedTime": {
          "type": "long"
        }
        "create_time": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss.SSS||yyyy-MM-dd HH:mm:ss||epoch_millis"
        }
      }
    }
  }
}

2.索引数据同步

POST _reindex
{
  "source": {
    "index": "xxx"
  },
  "dest": {
    "index": "xxx_v2"
  }
}

3.删除索引

DELETE /xxx/

4.索引重命名

POST _aliases
{
  "actions":[
      {
        "add":{
          "index":"xxx_v2",
          "alias":"xxx_alias"
        }
      }
    ]
}
上一篇 下一篇

猜你喜欢

热点阅读