刪除舊索引
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" : "別名"}}] }
https://blog.csdn.net/seanxwq/article/details/115175399