删除旧索引

  DELETE 索引名

创建新索引

PUT 索引名
{
  "settings": {
    "index": {
      "number_of_shards": "3",
      "number_of_replicas": "0"
    }
  }
}

设置索引mapping

PUT 索引名/_doc/_mapping
{
     
        "properties": {
          "id": {
            "type": "keyword"
          },
        
          "day": {
            "type": "integer"
          },
          "count": {
            "type": "double"
          },
          "level": {
            "type": "integer"
          }
      
}

这里要注意,如果是用http方式创建的话,mapping需要带s:mappings。如下:

设置别名

POST _aliases
{
  "actions" : [{"add" : {"index" : "索引名" , "alias" : "别名"}}]
}

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐