需求描述,operation-history-test的time没有索引,需要添加索引
1. 创建一个中间索引
# 创建索引,注意mapping修改成mappings
PUT operation-history-test-reindex/
{
"mappings":{
"properties":{
}
}
}
2. 向中间索引备份源索引的数据
# 重建索引
POST _reindex
{
"source": {
"index": "operation-history-test"
},
"dest": {
"index": "operation-history-test-reindex"
}
}
# 3.查询确认数据是否copy过去
GET /operation-history-test/_search
GET /operation-history-test-reindex/_search
4.删除有问题的索引
# 删除有问题的索引
DELETE operation-history-test
5.构建别名映射到原有的index上
POST _aliases
{
"actions": [
{
"add": {"index": "operation-history-test-reindex","alias": "operation-history-test"}
}
]
}