ES

作者: 紫荆秋雪_文 | 来源:发表于2020-06-18 11:28 被阅读0次

一、创建映射

#映射
PUT product
{
    "mappings" : {
      "properties" : {
        "attrs" : {
          "type" : "nested",
          "properties" : {
            "attrId" : {
              "type" : "long"
            },
            "attrName" : {
              "type" : "keyword"
            },
            "attrValue" : {
              "type" : "keyword"
            }
          }
        },
        "brandId" : {
          "type" : "long"
        },
        "brandImg" : {
          "type" : "keyword"
        },
        "brandName" : {
          "type" : "keyword"
        },
        "categoryId" : {
          "type" : "long"
        },
        "categoryName" : {
          "type" : "keyword"
        },
        "hasStock" : {
          "type" : "boolean"
        },
        "hotScore" : {
          "type" : "long"
        },
        "saleCount" : {
          "type" : "long"
        },
        "skuId" : {
          "type" : "long"
        },
        "skuImg" : {
          "type" : "keyword"
        },
        "skuPrice" : {
          "type" : "keyword"
        },
        "skuTitle" : {
          "type" : "text",
          "analyzer" : "ik_smart"
        },
        "spuId" : {
          "type" : "keyword"
        }
      }
    }
}

二、迁移数据

在迁移数据时,首先要创建映射

#迁移数据
POST _reindex
{
  "source": {
    "index": "product"
  },
  "dest": {
    "index": "new_product"
  }
}

相关文章

网友评论

      本文标题:ES

      本文链接:https://www.haomeiwen.com/subject/bfuyxktx.html