JavaEar 专注于收集分享传播有价值的技术资料

Elastic Schema Error - Root mapping definition has unsupported parameters

I am using elasticsearch version 2.1.1. When I try to create schema with the following payload, it gives Unsupported Parameters error:

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

The error message:

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

Can some one please help me identify the error here?

1个回答

    最佳答案
  1. There are couple of problems with this. You need to remove index name enron from payload. There is no multi_field in ES 2.1. You can refer to docs for more info

    This will work

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