ZPY博客

elasticsearch7新建mapping报错Failed to parse value [not_analyzed] as only [true] or [false] are allowed

elasticsearch7新建mapping报错如下:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Failed to parse mapping [_doc]: Could not convert [raw.index] to boolean"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [_doc]: Could not convert [raw.index] to boolean",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "Could not convert [raw.index] to boolean",
      "caused_by": {
        "type": "illegal_argument_exception",
        "reason": "Failed to parse value [not_analyzed] as only [true] or [false] are allowed."
      }
    }
  },
  "status": 400
}

原因:elsaticsearch7.x里没有not_analyzed这个东东,所以报错,在7.x里,只需指定type为keyword即为不分词。