ES创建索引出现的错误

一、报错:Root mapping definition has unsupported parameters

1、确认ES版本信息

//kibana输入命令
GET /

//得到如下信息
{
  "name" : "node-0",
  "cluster_name" : "xxx-platform",
  "cluster_uuid" : "6cYfmgArS2GXmHsxsSw0Eg",
  "version" : {
    "number" : "6.8.0", //版本信息
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "65b6179",
    "build_date" : "2019-05-15T20:06:13.172855Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

2、创建索引employee01

PUT /employee01
{
  "mappings": {
    "properties": {
      "name": {
        "type": "text"
      },
      "age": {
        "type": "integer"
      }
    }
  }
}

//报错如下
{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Root mapping definition has unsupported parameters:  [name : {type=text}] [age : {type=integer}]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [properties]: Root mapping definition has unsupported parameters:  [name : {type=text}] [age : {type=integer}]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "Root mapping definition has unsupported parameters:  [name : {type=text}] [age : {type=integer}]"
    }
  },
  "status": 400
}

正确的创建方式如下:


PUT /employee01
{
  "mappings": {
    "xxx": { ----------------区别所在
      "properties": {
        "name": {
          "type": "text"
        },
        "age": {
          "type": "integer"
        }
      }
    }
  }
}

你可能感兴趣的:(elasticsearch,大数据,搜索引擎)