elasticsearch - 弹性架构错误 - 根映射定义具有不受支持的参数

标签 elasticsearch

我使用的是 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
    }

有人可以帮我找出这里的错误吗?

最佳答案

这有几个问题。您需要从负载中删除索引名称 enron。没有 multi_field在 ES 2.1 中。可以引用docs了解更多信息

这会起作用

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"
    }
  }
}

关于elasticsearch - 弹性架构错误 - 根映射定义具有不受支持的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34734487/

相关文章:

elasticsearch - 如何跟踪每个用户不喜欢的项目并将其从结果中有效排除

google-app-engine - google app engine flex 上的 Elasticsearch 部署

elasticsearch - Elasticsearch 查询:仅查询整个单词

ruby-on-rails - Elasticsearch Ruby on Rails Content-Type header 错误

sorting - Elasticsearch中的相关排序

elasticsearch - 使index.max_result_window设置保持不变

elasticsearch - Elasticsearch 5.6身份验证

elasticsearch - 带有大写 token 的Elasticsearch word_delimiter过滤器不匹配

ruby-on-rails - update_all之后的Rails Elastic Search重新索引数据

MongoDB 4.x 实时同步到 ElasticSearch 6.x +