You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

重新创建已删除Elasticsearch索引时遇mapper_parsing_exception问题求助

问题分析与解决方案

错误原因

Elasticsearch 中 normalizer 参数仅支持配置在 keyword 类型字段上,你在 text 类型的 Type 字段上使用了该参数,导致映射解析失败,无法创建索引。

解决方案

1. 修正索引映射

根据业务需求选择以下两种修正方式:

  • 场景1:字段无需分词,仅需标准化处理(如统一小写)
    将 Type 字段类型改为 keyword,保留 normalizer 配置(需提前在 settings 中定义对应的标准化器):
PUT /原索引名
{
  "settings": {
    "analysis": {
      "normalizer": {
        "my_normalizer": {
          "type": "custom",
          "filter": ["lowercase"]
        }
      }
    }
  },
  "mappings": {
    "universal_profile": {
      "properties": {
        "Type": {
          "type": "keyword",
          "normalizer": "my_normalizer"
        }
      }
    }
  }
}
  • 场景2:字段需要分词检索
    移除 normalizer 参数,若需自定义分词规则,改用 analyzer 配置:
PUT /原索引名
{
  "mappings": {
    "universal_profile": {
      "properties": {
        "Type": {
          "type": "text",
          "analyzer": "standard" // 可替换为自定义分词器
        }
      }
    }
  }
}

2. 确认索引名可用性

先检查原索引是否彻底删除:

GET /_cat/indices?v

若索引仍存在,执行删除命令:

DELETE /原索引名

3. 迁移临时索引数据

索引创建成功后,将临时索引的数据迁移回来:

POST /_reindex
{
  "source": {
    "index": "临时索引名"
  },
  "dest": {
    "index": "原索引名"
  }
}

内容的提问来源于stack exchange,提问作者DSM

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 02:20:07