elasticSearch 修改映射 数据迁移

创建新的映射

PUT gulimall_product{
  {
    "mappings": {
        "properties": {
            "skuId": {
                "type": "long"
            },
            "spuId": {
                "type": "keyword"
            },
            "skuTitle": {
                "type": "text"
            },
            "skuPrice": {
                "type": "short"
            },
            "skuImg": {
                "type": "keyword"
            },
            "saleCount": {
                "type": "long"
            },
            "hasStock": {
                "type": "boolean"
            },
            "hotScore": {
                "type": "long"
            },
            "brandId": {
                "type": "long"
            },
            "catalogId": {
                "type": "long"
            },
            "brandName": {
                "type": "keyword"
            },
            "brandImg": {
                "type": "keyword"
            
            },
            "catalogName": {
                "type": "keyword"
            },
            "attrs": {
                "type": "nested",
                "properties": {
                    "attrId": {
                        "type": "long"
                    },
                    "attrName": {
                        "type": "keyword"
                    },
                    "attrValue": {
                        "type": "keyword"
                    }
                }
            }
        }
    }
}
}
#数据迁移
POST _reindex
{
  "source": {
    "index": "mall_product"
  },
  "dest": {
    "index": "gulimall_product"
  }
}

 

posted @ 2022-07-13 22:47  花心大萝卜li  阅读(85)  评论(0)    收藏  举报