Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 找不到org.elasticsearch.client.cancelable的类文件_Spring Boot_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch,Spring Boot,elasticsearch" /> elasticsearch,Spring Boot,elasticsearch" />

Spring boot 找不到org.elasticsearch.client.cancelable的类文件

Spring boot 找不到org.elasticsearch.client.cancelable的类文件,spring-boot,elasticsearch,Spring Boot,elasticsearch,我正在为elasticsearch 7.6.2构建一个spring boot应用程序。 我正在获取org.elasticsearch.client.cancelable的类文件,但未找到该文件生成时出错。 public class UpdateES { private static final Logger LOGGER = (Logger) LogManager.getLogger(UpdateES.class); public RestHighLevelClient esCl

我正在为elasticsearch 7.6.2构建一个spring boot应用程序。
我正在获取org.elasticsearch.client.cancelable的
类文件,但未找到该文件
生成时出错。

public class UpdateES {
    private static final Logger LOGGER = (Logger) LogManager.getLogger(UpdateES.class);
    public RestHighLevelClient esClient;

UpdateES(){
    int elasticPort = 9200;
    String elasticHost = "localhost";
    this.esClient = new RestHighLevelClient(RestClient.builder(
            new HttpHost(elasticHost, elasticPort,"http")));
}

public void update_ES(){
    UpdateByQueryRequest request = new UpdateByQueryRequest("air_messages");
    request.setConflicts("proceed");
    request.setBatchSize(10);
    request.setScript(
            new Script(
                    ScriptType.INLINE, "painless",
                    "if (ctx._source._id < 10000) {ctx._source.update += 1}",
                    Collections.emptyMap()));
    ActionListener<BulkByScrollResponse> listener = new ActionListener<BulkByScrollResponse>() {
        @Override
        public void onResponse(BulkByScrollResponse bulkResponse) {
            LOGGER.info("Successfully Updated");
        }

        @Override
        public void onFailure(Exception e) {
            LOGGER.info("Failed updating");
        }
    };
    esClient.updateByQueryAsync(request,RequestOptions.DEFAULT,listener);
}
公共类更新对象{
私有静态最终记录器=(记录器)LogManager.getLogger(UpdateES.class);
公共RestHighLevelClient客户端;
更新对象(){
int elasticPort=9200;
字符串elasticHost=“localhost”;
this.esClient=新的RestHighLevelClient(RestClient.builder(
新的HttpHost(elasticHost,elasticPort,“http”);
}
公共作废更新_ES(){
UpdateByQueryRequest请求=新的UpdateByQueryRequest(“air_消息”);
请求。设置冲突(“继续”);
请求。尺寸(10);
request.setScript(
新剧本(
ScriptType.INLINE,“无痛”,
“如果(ctx.\u source.\u id<10000){ctx.\u source.update+=1}”,
Collections.emptyMap());
ActionListener=新建ActionListener(){
@凌驾
公共无效onResponse(BulkByScrollResponse bulkResponse){
LOGGER.info(“已成功更新”);
}
@凌驾
公共失效失效失效(例外e){
LOGGER.info(“更新失败”);
}
};
updateByQueryAsync(请求,RequestOptions.DEFAULT,侦听器);
}

}`

检查类路径中的
elasticsearch rest高级客户端
elasticsearch rest客户端
是否具有相同的版本

编译'org.elasticsearch.client:elasticsearch rest客户端:7.6.2'

原因-
elasticsearch rest高级客户端
取决于
elasticsearch rest客户端
。检查是否明确提到了rest客户端的较低版本。为类路径中的两个库维护相同的版本。如果使用诸如Maven或Gradle之类的构建工具,除非您显式地使用较低版本覆盖它,否则它们将被自动处理