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 <weinan.gao@derbysoft.net>

---------

Signed-off-by: weinan_gao <weinan.gao@derbysoft.net>
Co-authored-by: weinan_gao <weinan.gao@derbysoft.net>
Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
This commit is contained in:
gwny 2023-11-29 06:16:00 +08:00 committed by GitHub
parent ff1dc0eb36
commit b20a2d8463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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<SSLEngine, TlsDetails>() {
@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()
)