Source:
<code>private EsClient(final EsClientConfiguration configuration) { this.client = Activator.withTccl(() -> { final HttpHost host = configuration.getHost(); final RequestConfigCallback requestConfigCallback = requestConfigBuilder -> requestConfigBuilder .setConnectTimeout(configuration.getConnectTimeout()) .setSocketTimeout(configuration.getSocketTimeout()); final RestClientBuilder restClientBuilder = RestClient.builder(host) .setRequestConfigCallback(requestConfigCallback) .setMaxRetryTimeoutMillis(configuration.getSocketTimeout()); boolean useAuthentication = !Strings.isNullOrEmpty(configuration.getUserName()) && !Strings.isNullOrEmpty(configuration.getPassword()); if (useAuthentication) { final HttpClientConfigCallback httpClientConfigCallback = httpClientConfigBuilder -> { final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(configuration.getUserName(), configuration.getPassword())); return httpClientConfigBuilder.setDefaultCredentialsProvider(credentialsProvider); }; restClientBuilder.setHttpClientConfigCallback(httpClientConfigCallback); } LOG.info("ES REST client is connecting to '{}'{}, connect timeout: ms, socket timeout: ms.", host.toURI(), useAuthentication ? " using basic authentication" : "", configuration.getConnectTimeout(), configuration.getSocketTimeout()); final RestHighLevelClient client = new RestHighLevelClient(restClientBuilder); try { checkState(client.ping(), "The cluster at '%s' is not available.", host.toURI()); } catch (Exception e) { if (e instanceof ElasticsearchStatusException && ((ElasticsearchStatusException) e).status() == RestStatus.UNAUTHORIZED) { <START> LOG.error("Unable to authenticate with remote cluster '{}' using the predefined credentials", host.toURI()); <END> } closeClient(configuration, client); throw e; } return client; }); this.registry = ReflectionUtils.getField(RestHighLevelClient.class, client, "registry"); }</code><technical_language>predefined +given? "Predefined" administrators anxious, in control of passwords</technical_language>

Target:
private EsClient(final EsClientConfiguration configuration) { this.client = Activator.withTccl(() -> { final HttpHost host = configuration.getHost(); final RequestConfigCallback requestConfigCallback = requestConfigBuilder -> requestConfigBuilder .setConnectTimeout(configuration.getConnectTimeout()) .setSocketTimeout(configuration.getSocketTimeout()); final RestClientBuilder restClientBuilder = RestClient.builder(host) .setRequestConfigCallback(requestConfigCallback) .setMaxRetryTimeoutMillis(configuration.getSocketTimeout()); boolean useAuthentication = !Strings.isNullOrEmpty(configuration.getUserName()) && !Strings.isNullOrEmpty(configuration.getPassword()); if (useAuthentication) { final HttpClientConfigCallback httpClientConfigCallback = httpClientConfigBuilder -> { final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(configuration.getUserName(), configuration.getPassword())); return httpClientConfigBuilder.setDefaultCredentialsProvider(credentialsProvider); }; restClientBuilder.setHttpClientConfigCallback(httpClientConfigCallback); } LOG.info("ES REST client is connecting to '{}'{}, connect timeout: ms, socket timeout: ms.", host.toURI(), useAuthentication ? " using basic authentication" : "", configuration.getConnectTimeout(), configuration.getSocketTimeout()); final RestHighLevelClient client = new RestHighLevelClient(restClientBuilder); try { checkState(client.ping(), "The cluster at '%s' is not available.", host.toURI()); } catch (Exception e) { if (e instanceof ElasticsearchStatusException && ((ElasticsearchStatusException) e).status() == RestStatus.UNAUTHORIZED) { LOG.error("Unable to authenticate with remote cluster '{}' using the given credentials", host.toURI()); } closeClient(configuration, client); throw e; } return client; }); this.registry = ReflectionUtils.getField(RestHighLevelClient.class, client, "registry"); }