“type”: “illegal_argument_exception”,
“reason”: “Can’t load fielddata on [brandName] because fielddata is unsupported on fields of type [keyword]. Use doc values instead.”
因属性中设置doc_values 为false导致keyword类型不支持
解决方式:调整Mapping字段
原有数据Mapping:
{
"product" : {
"mappings" : {
"properties" : {
"brandId" : {
"type" : "long"
},
"brandImg" : {
"type" : "keyword",
"index" : false,
"doc_values" : false
},
"brandName" : {
"type" : "keyword",
"index" : false,
"doc_values" : false
},
"catalogId" : {
"type" : "long"
},
"catalogName" : {
"type" : "keyword",
"index" : false,
"doc_values" : false
},
"hasStock" : {
"type" : "boolean"
},
"hotScore" : {
"type" : "long"
},
"saleCount" : {
"type" : "long"
},
"skuId" : {
"type" : "long"
},
"skuImg" : {
"type" : "keyword",
"index" : false,
"doc_values" : false
},
"skuPrice" : {
"type" : "keyword"
},
"skuTitle" : {
"type" : "text",
"analyzer" : "ik_smart"
},
"spuId" : {
"type" : "keyword"
}
}
}
}
}
去掉当前doc_values设置或者设置为true
PUT shop_product
{
"mappings" : {
"properties" : {
"brandId" : {
"type" : "long"
},
"brandImg" : {
"type" : "keyword"
},
"brandName" : {
"type" : "keyword"
},
"catalogId" : {
"type" : "long"
},
"catalogName" : {
"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": "shop_product"
}
}
GET shop_product/_search