None of the configured nodes are available: [{#transport#-1}{...}{}{}]

I use ElasticSearch v5.0 in java application and create index. But the 9300 port can't work.

Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{wT9q99-KSTObzOpHJGj5bA}{}{}]]

This is java code:

public static void main(String[] args) {
        Settings settings = Settings.builder()
                .put("client.transport.sniff", true)
                .put("", "clusterTest")
        client = new PreBuiltTransportClient(settings)
                .addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("", 9300)));
        List<String> jsonList = DataFactory.getInitJsonData();
        String indexname = "esIndex";
        String type = "esType";

        ElasticApp app = new ElasticApp();
        app.createIndex(indexname, type, jsonList);

    private void createIndex(String indexname, String type, List<String> jsonList){
        try {
            IndexRequestBuilder requestBuilder = client.prepareIndex(indexname, type, "1").setCreate(true);

            for (int i=0;i<jsonList.size();i++){

            System.out.print("Create Index Success");
        } catch (IOException e) {
1 Like

There are two ports used by Elasticsearch. The port 9200 provides access through http (e.g. your browser). The port 9300 is used for accessing Elasticsearch through the internal transport protocol, which is used by the Java transport client.

Can you check whether the you've used in your java example corresponds to the cluster name you've used in your Elasticsearch cluster configuration (elasticsearch.yml)?


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