Elasticsearch 2.x版本往5.x版本迁移数据
迁移前准备
1. String类型:
2.x版本 跟 5.x版本有一个比较大的改动就是ES的基本类型string字段。5.x版本中使用text/keyword字段替代了2.x版本的string类型。text表示使用分词的string(即之前默认的string),keyword为不使用分词的string(即not_analyzed), keyword类型的数据只能完全匹配,适合那些不需要分词的数据,对过滤、聚合非常友好。
如下2.x版本中的mapping片段:
"content" : {
"properties" : {
"status" : {
"type" : "string"
},
"tgroup" : {
"type" : "string",
"index" : "not_analyzed"
},
}
}
5.x版本中可以修改为如下:
"content" : {
"properties" : {
"status" : {
"type" : "text"
},
"tgroup" : {
"type" : "keyword",
},
}
},
S