标签:any pcl password tco lsp ack 有用 res als
HttpHost host=new HttpHost(“IP地址”, “端口号”, HttpHost.DEFAULT_SCHEME_NAME);
RestClientBuilder builder=RestClient.builder(host);
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(“用户名”, “密码”));
builder.setHttpClientConfigCallback(f -> f.setDefaultCredentialsProvider(credentialsProvider));
RestHighLevelClient restClient = new RestHighLevelClient( builder);
使用RestHighLevelClient 连接带有用户名密码ES机器
标签:any pcl password tco lsp ack 有用 res als
原文地址:https://www.cnblogs.com/pxinhai/p/12685424.html