一、创建新的index及type(修改后的)
PUT gmall01050
{
"mappings": {
"PmsSkuInfo":{
"properties": {
"id":{
"type": "long",
"index": true
},
"skuName":{
"type": "text",
"analyzer": "ik_max_word"
},
"skuDesc":{
"type": "text",
"analyzer": "ik_smart"
},
"catalog3Id":{
"type": "keyword"
},
"price":{
"type": "double"
},
"skuDefaultImg":{
"type": "keyword",
"index": false
},
"hotScore":{
"type": "double"
},
"productId":{
"type": "keyword"
},
"skuAttrValueList":{
"properties": {
"productId":{
"type": "keyword"
},
"attrId":{
"type": "keyword"
},
"valueId":{
"type": "keyword"
},
"skuId":{
"type": "keyword"
}
}
}
}
}
}
}
二、将原indexs数据复制到新index
POST _reindex
{
"source":{
"index":"gmall0105"
},
"dest":{
"index":"gmall01050"
}
}
三、删除原index
DELETE gmall0105
四、再将新index数据复制到原index
先按第一步在建一个一样的表
POST _reindex
{
"source":{
"index":"gmall01050"
},
"dest":{
"index":"gmall0105",
}
}
五、将新index删除
DELETE gmall01050
- 查看index数据类型
GET gmall01050/PmsSkuInfo/_mapping
- 查看index所有数据
GET gmall0105/PmsSkuInfo/_search
{
"query": {
"match_all": {}
}
}