Fix Java client example (#6438)
The syntax provided for the second example at https://opensearch.org/docs/latest/clients/java/#initializing-the-client-with-ssl-and-tls-enabled-using-restclient-transport is invalid: - hostname and port order are reversed - the password field is a character array The correct syntax is used earlier on the page for the Apache HTTP client version. Signed-off-by: Daniel Widdis <widdis@gmail.com>
This commit is contained in:
parent
9af42a86f4
commit
93878a9e29
|
@ -222,10 +222,10 @@ public class OpenSearchClientExample {
|
|||
System.setProperty("javax.net.ssl.trustStore", "/full/path/to/keystore");
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", "password-to-keystore");
|
||||
|
||||
final HttpHost host = new HttpHost("https", 9200, "localhost");
|
||||
final HttpHost host = new HttpHost("https", "localhost", 9200);
|
||||
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
|
||||
//Only for demo purposes. Don't specify your credentials in code.
|
||||
credentialsProvider.setCredentials(new AuthScope(host), new UsernamePasswordCredentials("admin", "admin"));
|
||||
credentialsProvider.setCredentials(new AuthScope(host), new UsernamePasswordCredentials("admin", "admin".toCharArray()));
|
||||
|
||||
//Initialize the client with SSL and TLS enabled
|
||||
final RestClient restClient = RestClient.builder(host).
|
||||
|
|
Loading…
Reference in New Issue