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

由于之前创建商品索引是‘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  ·  5年前

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

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
leo
最佳答案

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

6.5. Elasticsearch 基础概念

5年前 评论
讨论数量: 1
leo

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

6.5. Elasticsearch 基础概念

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!