更新商品索引,捕获 ‘非法参数’ 异常?

由于之前创建商品索引是‘type’类型写错了,写成了:

curl -H 'Content-type:application/json' -XPOST http://localhost:9200/products/_mapping/_doc?pretty -d '{
    "properties": {
        "type": {"type": "text", "analyzer": "ik_smart"},

导致现在更新索引是抛出异常:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "mapper [type] of different type, current_type [text], merged_type [keyword]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "mapper [type] of different type, current_type [text], merged_type [keyword]"
  },
  "status" : 400
}

这个要怎么解决啊?

附言 1  ·  6年前

行吧,把之前的索引删了重来一遍

《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
leo
最佳答案

在 6.5 节介绍过了,Elasticsearch 是不支持修改字段类型的

6.5. Elasticsearch 基础概念

6年前 评论