Rejecting mapping update to [***] as the final mapping would have more than 1 type: [***, ***]

在整合springboot和elasticsearch时,使用spring data进行添加数据时,报错:

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource 
[org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: 
    Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]: 
Factory method 'requestMappingHandlerAdapter' threw exception; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed;
 nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.springframework.format.support.FormattingConversionService]:
 Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookRepository': Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.elasticsearch.repository.support.NumberKeyedRepository]: 
Constructor threw exception; nested exception is java.lang.IllegalArgumentException: 
Rejecting mapping update to [****] as the final mapping would have more than 1 type: [***, *****]

原因:

Elasticsearch 6.0 一个索引只允许有一个type;

Elasticsearch 7.0 没有 Type 了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个错误消息表明 Elasticsearch 的可用处理器数量已经被设置为 8,再次尝试将其设置为 8 时被拒绝了。这是由于 Elasticsearch 在初始化时只允许设置一次可用处理器数量,无法重复设置。 解决这个问题的方法是确保只有一处设置了可用处理器数量的地方,并且值是一致的。您可以按照以下步骤进行排查: 1. 检查您的代码,确保只有一处设置了可用处理器数量。可能是在不同的配置文件或代码段中重复设置了该属性。 2. 确保您的依赖库和 Elasticsearch 版本兼容。某些版本的 Elasticsearch 客户端可能对可用处理器数量的设置有限制或者不兼容。 3. 如果您在代码中使用了其他第三方库或者框架,尝试查找是否有类似于设置可用处理器数量的配置项,可能会与 Elasticsearch 的设置冲突。 为了解决这个问题,您可以尝试以下操作: 1. 将所有设置可用处理器数量的地方都移除,并确保只在一个地方进行设置。如果您使用的是 Spring Boot,可以考虑使用 `spring.data.elasticsearch.properties` 属性来集中配置 Elasticsearch 的相关属性。 2. 如果您没有特殊需求,可以尝试删除手动设置可用处理器数量的代码,让 Elasticsearch 使用默认值。 3. 如果您确实需要手动设置可用处理器数量,尝试将其设置为不同于 8 的值,例如 4 或 16,以避免冲突。 请注意,以上解决方案仅为参考,请根据具体情况进行调整。如果问题仍然存在,建议查阅 Elasticsearch 的官方文档或者咨询 Elasticsearch 社区获取更详细的帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值