多模块项目使用ElasticSearch报错

43 阅读1分钟

image.png @[TOC]

情况1:启动报错

maven包引入问题ClassNotFoundException: org.elasticsearch.client.Cancellable

原因:父pom引入ES 版本了,导致版本冲突 在这里插入图片描述 解决方案:修改父pom的ES的版本即可启动成功

情况2:java.lang.NoSuchMethodError: org.elasticsearch.action.index.IndexRequest.ifSeqNo()J

在这里插入图片描述 原因:有一种说法说jar里的Elasticsearch版本有错,要移除了再重新引入?答案待确定 在这里插入图片描述 解决办法:添加即可 在这里插入图片描述

情况3:java.lang.ClassNotFoundException: org.elasticsearch.client.indices.GetIndexRequest

在这里插入图片描述 原因:项目有两个子model,每个model都有一个注入es client的bean,这就造成一个项目里es有两套,肯定会有一个被覆盖

解决办法:统一即可

情况4:xx contains unrecognized parameter: [ccs_minimize_roundtrips]]

在这里插入图片描述 "message": "Elasticsearch exception [type=illegal_argument_exception, reason=request [/12_assets_directory_v1/_doc/_search] contains unrecognized parameter: [ccs_minimize_roundtrips]] 原因:ES版本不一致造成的

解决办法:找到索引引用ES的地方,确认版本一致

情况5:I/O reactor terminated abnormally

RestHighLevelClient请求ES报错 ↓ 在这里插入图片描述在这里插入图片描述 可能原因: 原因1:http/tcp建立连接请求太多,导致请求加不进去了 原因2:es内存不够用了,导致请求加不进去了

解决办法:重启ES或者增大内存

image.png

重要信息

image.png

image.png

image.png