一般日期格式的可能需要重新设置。
原始索引
PUT /people_v1{"settings": {"number_of_shards": 1,"number_of_replicas": 0}}# 设置别名PUT /people_v1/_alias/peoplePOST people_v1/_mapping/doc{"dynamic": "strict","properties": {"birth": {"type": "text"}}}POST /people_v1/doc{"birth": "2019-09-09"}
替换索引
PUT /people_v2{"settings": {"number_of_shards": 1,"number_of_replicas": 0}}POST people_v2/_mapping/doc{"dynamic": "strict","properties": {"birth": {"type": "date","format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"}}}POST _reindex{"source": {"index": "people_v1"},"dest": {"index": "people_v2"}}# 没问题的话修改别名,实现无缝切换索引POST /_aliases{"actions": [{"remove": {"index": "people_v1","alias": "people"}},{"add": {"index": "people_v2","alias": "people"}}]}# 验证是否成功,查看别名对应的索引GET /*/_alias/people
