From b20a2d84631d742321c26aded299b9dcb8a465f6 Mon Sep 17 00:00:00 2001 From: gwny Date: Wed, 29 Nov 2023 06:16:00 +0800 Subject: [PATCH] fix java client sample error. (#5504) * fix java client sample error. * Revert "fix java client sample error." * fix java sample error. Signed-off-by: weinan_gao --------- Signed-off-by: weinan_gao Co-authored-by: weinan_gao Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com> --- _clients/java.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_clients/java.md b/_clients/java.md index 445788e1..296e4d9a 100644 --- a/_clients/java.md +++ b/_clients/java.md @@ -171,7 +171,7 @@ public class OpenSearchClientExample { final ApacheHttpClient5TransportBuilder builder = ApacheHttpClient5TransportBuilder.builder(host); builder.setHttpClientConfigCallback(httpClientBuilder -> { final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create() - .setSslContext(SSLContextBuilder.create().build()) + .setSslContext(sslcontext) // See https://issues.apache.org/jira/browse/HTTPCLIENT-2219 .setTlsDetailsFactory(new Factory() { @Override @@ -191,7 +191,7 @@ public class OpenSearchClientExample { .setConnectionManager(connectionManager); }); - final OpenSearchTransport transport = ApacheHttpClient5TransportBuilder.builder(host).build(); + final OpenSearchTransport transport = builder.build(); OpenSearchClient client = new OpenSearchClient(transport); } } @@ -254,7 +254,7 @@ OpenSearchClient client = new OpenSearchClient( new AwsSdk2Transport( httpClient, "search-...us-west-2.es.amazonaws.com", // OpenSearch endpoint, without https:// - "es" + "es", Region.US_WEST_2, // signing service region AwsSdk2TransportOptions.builder().build() )