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

Elasticsearch 7.1.0创建映射报mapper_parsing_exception错误求助

问题原因

错误源于**多字段(multi-fields)**的配置语法错误。你在fields节点下直接定义了type和ignored_above属性,但Elasticsearch要求fields是一个键值对集合——键是子字段的名称(比如keyword),值才是该子字段的具体配置参数。另外原配置顶级键写为mapping,正确应为mappings(少了末尾的s),这也是潜在问题点。

修正后的完整映射配置
{
  "mappings": {
    "properties": {
      "TotalCapacity": {
        "type": "long"
      },
      "DiskUseState": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignored_above": 256
          }
        }
      },
      "DriveHostName": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignored_above": 256
          }
        }
      },
      "ModelNumber": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignored_above": 256
          }
        }
      },
      "DriveNodeUuid": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignored_above": 256
          }
        }
      },
      "DrivePath": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignored_above": 256
          }
        }
      },
      "DriveProtocol": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignored_above": 256
          }
        }
      }
    }
  }
}
核心修改说明
  • 给每个字段的fields节点添加子字段名称(这里用常规命名keyword,你也可以自定义),将type和ignored_above属性嵌套在子字段名称对应的对象内
  • 修正顶级配置键为mappings,符合Elasticsearch的语法要求
索引创建示例

你可以通过以下API请求创建索引(替换your_disk_index为你的索引名称):

PUT /your_disk_index
{
  # 上述修正后的映射内容
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.17 19:35:24