NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{IDKtOnPrQICBFDFU-dCxrw}{localhost}{127.0.0.1:9300}] ]

i run the es on docker , and it worked well

when i wanna use java client it throw exception:

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{fe2lzyyASMa7y-5slCY0rw}{localhost}{127.0.0.1:9300}]]

this is my pom parts:

and this is my code:
@RunWith(SpringRunner.class)
@SpringBootTest
public class Test1ApplicationTests {

        private static TransportClient client;

        @Before
        public void before() {
            try {
                 client = new PreBuiltTransportClient(
                        Settings.builder().put("cluster.name", "elasticsearch").put("client.transport.sniff", true)
                        .build())
                         .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
            } catch (UnknownHostException e) {
                e.printStackTrace();
            }
        }

        @Test
        public void CreateJSON() {

            String json = "{" +
                    "\"user\":\"kimchy\"," +
                    "\"postDate\":\"2013-01-30\"," +
                    "\"message\":\"trying out Elasticsearch\"" +
                    "}";
            IndexResponse response = client.prepareIndex("twitter", "tweet")
                    .setSource(json, XContentType.JSON)
                    .get();
            System.out.println(response.getResult());
        }
    }

Please don't post images of text as they are hardly readable and not searchable.

Instead paste the text and format it with </> icon. Check the preview window.

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

i have solved this issue, it worked well when i override the default clustername,

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