举例子:索引A为旧索引,索引B为新索引。
1、获取A索引(旧索引)的数据结构
GET /index_a/_mapping/
2、创建一个新的索引B,结构同A。
POST /index_b/_mapping/
{
"properties" : {
"age" : {
"type" : "long"
},
"education" : {
"type" : "text"
},
"other": {
"type": "text"
},
"name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"testedu" : {
"type" : "text"
}
}
}
3、迁移数据
POST _reindex
{
"source": {
"index": "index_a"
},
"dest": {
"index": "index_b"
}
}