当前位置:  开发笔记 > 数据库 > 正文

弹性模式错误 - 根映射定义具有不受支持的参数

如何解决《弹性模式错误-根映射定义具有不受支持的参数》经验,为你挑选了1个好方法。

我使用的是elasticsearch版本2.1.1.当我尝试使用以下有效内容创建模式时,它会给出"不支持的参数"错误:

URL : http://localhost:9200/enron/mails/_mapping
Operation: PUT
Payload:
    {
      "enron": {
        "properties": {
          "message_id": {
            "type": "string",
            "index": "not_analyzed",
            "store": "yes"
          },
          "from": {
            "type": "string",
            "index": "not_analyzed",
            "store": "yes"
          },
          "to": {
            "type": "string",
            "index": "not_analyzed",
            "store": "yes",
            "multi_field": "yes"
          },
          "x_cc": {
            "type": "string",
            "index": "not_analyzed",
            "store": "yes",
            "multi_field": "yes"
          },
          "x_bcc": {
            "type": "string",
            "index": "not_analyzed",
            "store": "yes",
            "multi_field": "yes"
          },
          "date": {
            "type": "date",
            "index": "not_analyzed",
            "store": "yes"
          },
          "subject": {
            "type": "string",
            "index": "analyzed",
            "store": "yes"
          },
          "body": {
            "type": "string",
            "index": "analyzed",
            "store": "yes"
          }
        }
      }
    }

错误消息:

    {
      "error": {
        "root_cause": [
          {
            "type": "mapper_parsing_exception",
            "reason": "Root mapping definition has unsupported parameters:  [enron : {properties={message_id={type=string, index=not_analyzed, store=yes}, from={type=string, index=not_analyzed, store=yes}, to={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_cc={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_bcc={type=string, index=not_analyzed, store=yes, multi_field=yes}, date={type=date, index=not_analyzed, store=yes}, subject={type=string, index=analyzed, store=yes}, body={type=string, index=analyzed, store=yes}}}]"
          }
        ],
        "type": "mapper_parsing_exception",
        "reason": "Root mapping definition has unsupported parameters:  [enron : {properties={message_id={type=string, index=not_analyzed, store=yes}, from={type=string, index=not_analyzed, store=yes}, to={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_cc={type=string, index=not_analyzed, store=yes, multi_field=yes}, x_bcc={type=string, index=not_analyzed, store=yes, multi_field=yes}, date={type=date, index=not_analyzed, store=yes}, subject={type=string, index=analyzed, store=yes}, body={type=string, index=analyzed, store=yes}}}]"
      },
      "status": 400
    }

有人可以帮我识别错误吗?



1> ChintanShah2..:

这有几个问题.您需要enron从有效负载中删除索引名称.ES 2.1中没有multi_field.您可以参考文档了解更多信息

这会奏效

PUT enron/mails/_mapping
{
  "properties": {
    "message_id": {
      "type": "string",
      "index": "not_analyzed",
      "store": "yes"
    },
    "from": {
      "type": "string",
      "index": "not_analyzed",
      "store": "yes"
    },
    "to": {
      "type": "string",
      "index": "not_analyzed",
      "store": "yes"
    },
    "x_cc": {
      "type": "string",
      "index": "not_analyzed",
      "store": "yes"
    },
    "x_bcc": {
      "type": "string",
      "index": "not_analyzed",
      "store": "yes"
    },
    "date": {
      "type": "date",
      "index": "not_analyzed",
      "store": "yes"
    },
    "subject": {
      "type": "string",
      "index": "analyzed",
      "store": "yes"
    },
    "body": {
      "type": "string",
      "index": "analyzed",
      "store": "yes"
    }
  }
}

推荐阅读
郑谊099_448
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有