首页 > 编程语言 > 详细

spring.data.elasticsearch.cluster-nodes、cluster-name过时

时间:2021-07-06 18:30:16      阅读:45      评论:0      收藏:0      [点我收藏+]

(1) 这个在高版本中已经废弃,如果要继续使用请将spring-boot.version改为2.1.3.RELEASE时,这两个结点有效,没有过时。

(2) 这个在高版本中已经废弃,官方建议我们使用:High Level REST Client

技术分享图片

@Configuration
public class ElasticsearchConfig {
    @Bean
    RestHighLevelClient elasticsearchClient() {
        ClientConfiguration configuration = ClientConfiguration.builder()
                .connectedTo("localhost:9300")
                //.withConnectTimeout(Duration.ofSeconds(5))
                //.withSocketTimeout(Duration.ofSeconds(3))
                //.useSsl()
                //.withDefaultHeaders(defaultHeaders)
                //.withBasicAuth(username, password)
                // ... other options
                .build();
        RestHighLevelClient client = RestClients.create(configuration).rest();
        return client;
    }
}

spring.data.elasticsearch.cluster-nodes、cluster-name过时

原文:https://www.cnblogs.com/xudong5273/p/14977793.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!