其他分享
首页 > 其他分享> > elasticSearch 修改映射 数据迁移

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"
  }
}

 

标签:index,product,映射,keyword,long,elasticSearch,迁移,type,properties
来源: https://www.cnblogs.com/Lcch/p/16475876.html