spring-boot - Elasticsearch在启动期间引发错误

标签 spring-boot elasticsearch spring-data spring-data-elasticsearch

我已经在Spring Boot中实现了Elasticsearch。每次重新启动服务器时,都会出现以下错误。

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productController': Unsatisfied dependency expressed through field 'ps'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productServiceImpl': Unsatisfied dependency expressed through field 'pr'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productRepository': Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Rejecting mapping update to [products] as the final mapping would have more than 1 type: [_doc, product]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]

我每次启动服务器后都删除了索引,然后执行索引。谁能给我建议解决方案

最佳答案

每个索引的Elasticsearch v6及更高版本不能具有多个类型。但是从您的异常来看,您的映射试图在索引上创建多个类型(_doc和product)

有关更多信息,请引用https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html

关于spring-boot - Elasticsearch在启动期间引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61974572/

相关文章:

java - Spring数据 Elasticsearch : remove low disk watermark warning

java - 获取 MongoDB 当前集合名称

java - 如何处理空参数的 JPA 查询方法中的所有枚举值

java - 如何在没有 spring @Component 或 @Bean 注释的情况下在我的项目中运行不同项目的 servlet-filter

java - Spring Boot 分段上传获取空文件对象

java - ConversionService bean 与用于转换对象的常规转换器 bean

threadpool - Spring中最大(客户端请求)线程池大小

Elasticsearch 查询多个子字段

python - 在elasticsearch上使用python在所有字段上进行搜索

java - Spring data CrudRepository findBy 关系