diff --git a/waynboot-data/waynboot-data-elastic/src/main/java/com/wayn/data/elastic/config/ElasticClientConfig.java b/waynboot-data/waynboot-data-elastic/src/main/java/com/wayn/data/elastic/config/ElasticClientConfig.java index 2f86260..48e89d3 100644 --- a/waynboot-data/waynboot-data-elastic/src/main/java/com/wayn/data/elastic/config/ElasticClientConfig.java +++ b/waynboot-data/waynboot-data-elastic/src/main/java/com/wayn/data/elastic/config/ElasticClientConfig.java @@ -20,7 +20,8 @@ public class ElasticClientConfig { // 开始设置用户名和密码 CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(config.getUsername(), config.getPassword())); - builder.setHttpClientConfigCallback(f -> f.setDefaultCredentialsProvider(credentialsProvider)); + builder.setHttpClientConfigCallback(f -> f.setDefaultCredentialsProvider(credentialsProvider) + .setKeepAliveStrategy((response, context) -> 1000 * 60)); return builder; }