ClientConfiguration.connectedTo 设置错误的连接 [英] ClientConfiguration.connectedTo sets wrong connection

查看:53
本文介绍了ClientConfiguration.connectedTo 设置错误的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个配置

@EnableElasticsearchRepositories
@Configuration
public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {

    @Bean
    @Override
    public RestHighLevelClient elasticsearchClient() {
        HgElasticsearchProperties properties = appPropertiesService.getElasticsearchProperties();

        final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
                .connectedTo("https://localhost:443")
                .build();

        return RestClients.create(clientConfiguration).rest();
    }
}

结果我有了这个 ClientConfiguration:

And I have this ClientConfiguration as a result:

如何设置正确的弹性连接?("https://localhost:443")

How can I set the correct elastic connection up? ("https://localhost:443")

推荐答案

安全连接的设置是:

.connectedTo("localhost").useSsl()

localhost:443",这里也需要定义端口

"localhost:443", the port needs to be defined here as well

这篇关于ClientConfiguration.connectedTo 设置错误的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆