Java API connect the ES

Dear team,
recently, I using the java API connect the ES 2.3.3 client which has installed the shield. the error as flows:

     Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available:

BTW, I cannot found the user and password setting in elasticsearch.yml. here was my java code:

public static Client getEsConnection()
{
String clusterName = "elasticsearch";

    Settings settings = Settings.settingsBuilder()
            .put("cluster.name", clusterName)
            .build();
    Client client = null;
    try {
        client = TransportClient.builder().settings(settings).build()
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("10.xx.xx.xx"), 9300))
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("10.xx.xx.xx"), 9300))
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("10.xx.xx.xx"), 9300));

    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    return client;

}

Levi,
thanks

Here we go: https://www.elastic.co/guide/en/shield/current/_using_elasticsearch_java_clients_with_shield.html

Thanks for quick response!

Thanks for dadoonet , I resolve it fallowing the url!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.