1.获取索引的数据类型结构mapping
GET self-2020.04.17/_mapping
GET self-2020.04.17-new/_mapping
2.创建新的索引,修改数据类型
PUT self-2020.04.17-new
{
"mappings": {
"doc": {
"properties": {
"tokenCreTimeStr": {
"type": "date"
}
}
}
}
}
3.拷贝数据
POST _reindex
{
"source": {
"index": "self-2020.04.17"
},
"dest": {
"index": "self-2020.04.17-new"
}
}
4.删除旧的索引
DELETE self-2020.04.17
5.设置新的索引别名
POST /_aliases
{
"actions": [
{"add": {"index": "self-2020.04.17-new", "alias": "self-2020.04.17"}}
]
}