PUT 映射错误 elasticsearch with rest client:解析映射失败 [_doc]:根映射定义有不支持的参数:

PUT mapping error elasticsearch with rest client : Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:

正如您在附件中看到的,我想创建一个名为 movie 的映射,但出现以下错误: 无法解析映射 [_doc]:根映射定义具有不受支持的参数:

{
  "mappings": {
    "movie":{
      "properties": {
        "year": {
          "type": "date"
        }
      }
    }
  }
}

在 elasticearch v 7.8 上

您正在尝试使用类型创建映射,在您的情况下 movie,但自版本 7.0 以来,映射是 typeless,您不能再使用类型创建映射。

您应该使用以下映射。

{
  "mappings": {
    "properties": {
      "year": {
        "type": "date"
      }
    }
  }
}

这将为字段 year 创建日期 date 的映射。