完整报错信息
02-25 20:06:14.214 [main] WARN org.elasticsearch.client.RestClient - request [PUT http://192.168.178.129:9200/hotel?master_timeout=30s&include_type_name=true&timeout=30s] returned 1 warnings: [299 Elasticsearch-7.12.1-3186837139b9c6b6d23c3200870651f10d3343b7 "[types removal] Using include_type_name in create index requests is deprecated. The parameter will be removed in the next major version."]
ElasticsearchStatusException[Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [properties]: Root mapping definition has unsupported parameters: [all : {analyzer=ik_max_word, type=text}] [score : {type=integer}] [address : {index=false, type=keyword}] [business : {copy_to=all, type=keyword}] [city : {type=keyword}] [price : {type=integer}] [starName : {type=keyword}] [name : {copy_to=all, analyzer=ik_max_word, type=text}] [location : {type=geo_point}] [id : {type=keyword}] [pic : {index=false, type=keyword}] [brand : {copy_to=all, type=keyword}]]
]; nested: ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=Root mapping definition has unsupported parameters: [all : {analyzer=ik_max_word, type=text}] [score : {type=integer}] [address : {index=false, type=keyword}] [business : {copy_to=all, type=keyword}] [city : {type=keyword}] [price : {type=integer}] [starName : {type=keyword}] [name : {copy_to=all, analyzer=ik_max_word, type=text}] [location : {type=geo_point}] [id : {type=keyword}] [pic : {index=false, type=keyword}] [brand : {copy_to=all, type=keyword}]]];
错误原因
CreateIndexRequest request = new CreateIndexRequest("hotel");
的选择出错
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
应该是
import org.elasticsearch.client.indices.CreateIndexRequest;