Commit 63a7ed76 authored by suhuiguang's avatar suhuiguang

style(cm): es初始请求

1.注释修改
parent 2959bad5
......@@ -31,8 +31,7 @@ public class ElasticSearchClientConfig {
@Bean(destroyMethod = "close")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
try {
HttpHost[] httpHosts = Arrays.stream(uris.split(",")).map(HttpHost::create).toArray(HttpHost[]::new);
......@@ -50,10 +49,9 @@ public class ElasticSearchClientConfig {
});
// 请求级参数配置
builder.setRequestConfigCallback(requestConfigBuilder -> {
// 连接超时(默认为1秒)
return requestConfigBuilder.setConnectTimeout(5000 * 1000)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.setSocketTimeout(6000 * 1000);
return requestConfigBuilder
.setConnectTimeout(5000 * 1000) // 连接超时毫秒
.setSocketTimeout(6000 * 1000); // 读取超时毫秒
});
return new RestHighLevelClient(builder);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment