I was following the instructions from here:
https://www.elastic.co/guide/en/x-pack/current/java-clients.html
and just for my initial tests I've used the following example:
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
TransportClient client = new PreBuiltXPackTransportClient(Settings.builder()
.put("cluster.name", "myClusterName")
.put("xpack.security.user", "transport_client_user:x-pack-test-password")
...
.build())
I'm adding the transport address like this (attention it's groovy code ):
InetAddress.getAllByName("elasticSearchAPIEndpoint_found_at_https://cloud.elastic.co/").each { address ->
if ((address instanceof Inet6Address) || (address instanceof Inet4Address)) {
client.addTransportAddress(new InetSocketTransportAddress(address, 9243))
}
}
Of course with the correct address to my cloud instance and my correct xpack.security.user, also have created a new user in Kibana with role "transport_client".
ES version is 5.6.1
x-pack-transport: 5.6.1
These are the settings I can see when debugging:
My result for connectedNodes() is always empty.