映射器与现有映射器有冲突例如:Mapper for [composeGoodName] conflicts with existing mapping in other types:_xiaobailx的博客-程序员宅基地

技术标签: Elasticsearch  elasticsearch  mapper  springboot  

说来惭愧,这本是一个不应该出现的错误:
pojo类中的部分代码:让composeGoodName使用ik分词器。

@Document(indexName = "seasonal",type = "escomposegood", shards = 4, replicas = 0)
public class ESComposeGood {
    
    @Id
    private Long id;
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String composeGoodName;
    @Field(type = FieldType.Integer)
    private Integer composeGoodPrice;
    @Field(type = FieldType.Long)
    private Long composeGoodType;
    @Field(type = FieldType.Integer)
    private Integer composeGoodStatus;
    @Field(type = FieldType.Integer)
    private Integer composeGoodWeight;
    @Field(type = FieldType.Keyword)
    private String composeGoodIcon;
    @Field(type = FieldType.Integer)
    private Integer composeGoodSales;
    }
   

意外发生了,程序跑不起来了,他告诉我:

[mapper [composeGoodName] has different [analyzer]]
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 'ESComposeGoodResitory': 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:
 Mapper for [composeGoodName] conflicts with existing mapping in other types:(这句才是错误的核心)

一番查找后发现如果在使用分词器之前将数据插入了Elasticsearch那么就会发生Elasticsearch无法解析的问题,也就是上述错误所以说:
解决方案:
在向Elasticsearch中插入数据之前就要给需要的进行分词的属性标记好解析,然后再插入数据即可解决问题!

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/xiaobailx/article/details/102170201

智能推荐

docker 安装mysql 远程无法连接原因 报错10061 报错1251_q952420873的博客-程序员宅基地

1、进入容器:[[email protected] ~]# docker exec -it 容器id bash2、进入mysql:[email protected]:/# mysql -uroot -p3、输入密码,进入到mysql界面:4、查看密码加密规则select host,user,plugin,authentication_string from mysql.user;4、对远程连接进行授权...

A*算法求解八数码问题_a算法解决八数码问题_我家没有法拉利的博客-程序员宅基地

实验内容1 参考A算法核心代码,以8数码问题为例实现A算法的求解程序(编程语言不限),要求设计两种不同的估价函数。2 在求解8数码问题的A算法程序中,设置相同的初始状态和目标状态,针对不同的估价函数,求得问题的解,并比较它们对搜索算法性能的影响,包括扩展节点数、生成节点数等。3 对于8数码问题,设置与上述2相同的初始状态和目标状态,用宽度优先搜索算法(即令估计代价h(n)=0的A算法)求得问...

python-tornado的接口用swagger的进行包装_小小醬油君的博客-程序员宅基地

主要是static文件的生成我们用swagger就是为了做一个静态页面,也就是生成一个static文件: 几个必备的工具:swagger-py-codegen我们不用他们的文件框架只需要其生成的static文件,拷贝到自己文件夹下即可; 1)需要注意的是生成文件需要用yaml文件,当编辑好文件后,最主要的是要注意base_path文件的改动,你生成的文件的请求会加上你basepath的内...

为什么重写equals方法同时需要重写hashCode方法?_eq hashcode_饶艳辉的博客-程序员宅基地

为什么重写equals方法同时需要重写hashCode方法?众所周知equals()和hashCode()是Object类中定义的方法。Object类定义的方法如下:Object的equals()定义如下:注释部分大概意思是:请注意,每当重写此方法时,通常需要重写哈希代码,其中规定相等的对象必须具有相等的哈希代码。Object的hashCode()定义如下:以上...

深入理解分布式技术 - 分库分表后的扩容解决方案_小小工匠的博客-程序员宅基地

文章目录概述路由规则与扩容方案概述在实际开发中,数据库的扩容和不同的分库分表规则直接相关,今天我们从系统设计的角度,抽象了一个项目开发中出现的业务场景,从数据库设计、路由规则,以及数据迁移方案的角度进行讨论。假设这样一个业务场景,现在要设计网站的订单数据库模块,经过对业务增长的估算,预估三年后,数据规模可能达到 6000 万,每日订单数会超过 10 万。首先选择存储实现,订单作为电商业务的核心数据,应该尽量避免数据丢失,并且对数据一致性有强要求,肯定是选择支持事务的关系型数据库,比如使用

随便推点

pl0语言的语法分析_pl0语言语法分析c++_fffalling的博客-程序员宅基地

#include <bits/stdc++.h>using namespace std;const int N=1e5+10;string s1[11]={"begin","end","if","then","while","do","const","var","call","procedure","odd"};string s2[14]={"+","-","*","/","...

php下使用CURL设置超时的问题_weixin_34018202的博客-程序员宅基地

2019独角兽企业重金招聘Python工程师标准>>> ...

Java异常面试题(含答案)_毛发旺盛的程序员的博客-程序员宅基地

1、Java中异常分为哪两种?编译时异常运行时异常2、异常的处理机制有几种?异常捕捉:try…catch…finally,异常抛出:throws。3、如何自定义一个异常继承一个异常类,通常是RumtimeException或者Exception4、try catch fifinally,try里有return,finally还执行么?执行,并且finally的执行早于try里面的r...

hibernate--错误:javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey_您宁的博客-程序员宅基地

错误:javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKeyhibernate4的hibernate-jpa-2.1-api-1.0.0.Final.jar与javaee6中的javax.persistence.jar包冲突我在myeclipse10中添加默认的javaee6,在junit

fiddler抓包后APP无法访问的解决_fiddler抓包app无法登录_地瓜然然的博客-程序员宅基地

fiddler抓包后APP无法访问的解决问题原因如何解决手机抓包的具体操作问题原因如果开启fiddler抓包后,部分APP正常解密HTTPS,部分APP不行(比较典型的是应用商店,淘宝,知乎等)问题的原因基本都是因为对应APP开启了证书校验,英文名是证书 Pinning。具体Pinning原理不解释了,基本原理是APP内置了一个证书校验。导致你虽然安装并且信任了你抓包工具的证书,但是如果AP...

今天搞清楚了java连接db2的问题,jdbc的解决方案_wkwanglei的博客-程序员宅基地

java连接db2的问题,大家已经都讨论过了。看到论坛里又有坛友提问,我也就自己测试总结出来,共享下.JavaSoft将JDBC驱动程序细分为四大类,就是大家经常讲的type1,或者type4等.1.JDBC/ODBC Bridge是一项瘦编译元件,能将JDBC功能调用转换为

推荐文章

热门文章

相关标签