报错信息

具体报错:
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=illegal_argument_exception, reason=unknown setting [index.mappings.properties.category.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings]
报错原因
在执行下面的代码,进行创建索引时报错。
我定义MAPPING_TEMPLATE 的代码如下
 private static final String MAPPING_TEMPLATE = """
            {
              "mappings": {
                "properties": {
                  "id": {
                    "type": "keyword",
                    "index": false
                  },
                  "title":{
                    "type": "text",
                    "analyzer": "ik_max_word"
                  },
                  "user_id":{
                    "type": "keyword",
                    "index": false
                  },
                  "category_id":{
                    "type": "keyword",
                    "index": false
                  },
                  "category":{
                   "type": "text",
                    "analyzer": "ik_max_word"
                  },
                  "createTime":{
                    "type": "date"
                  }
                }
              }
            }"""; 请这样,模版中的红色框中的部分,就是这里引起的报错。 
问题解决
1、修改创建索引调用的方法
如果创建索引的模版和我的模版一样是以mappings 开始的,将创建索引的代码修改为下面的代码
 request.source(MAPPING_TEMPLATE, XContentType.JSON);2、修改创建索引的模版
如果调用创建模版的方法是
 request.settings(MAPPING_TEMPLATE, XContentType.JSON);就去掉索引模版中的mappings ,改为以properties开头




















