简体   繁体   中英

ElasticSearch GetApi NoNodeAvailableException

I tried using https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-get.html , the elastic search documentation, to get a document from an index i just created

my entire code is:

TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
    .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
GetResponse response = client.prepareGet("twitter", "tweet", "1").get();

I get the following exception (when i get to the 'get' row):

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{dUtRDm92Tg6ob6GVMtbgWA}{127.0.0.1}{127.0.0.1:9300}]]
    at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347)
    at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245)
    at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
    at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:363)
    at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
    at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62)
    at 

I searched for answers and got the following solutions:

I am using the same version of elastic search 5.5.0 Elasticsearch NoNodeAvailableException

giving the name of the cluster(if it was changed in elasticsearch.yml) Java ElasticSearch None of the configured nodes are available NoNodeAvailableException : None of the configured nodes are available

another solution was the port - using 9200-9300, 9300-9400 and tried using client.transport.sniff option Java ElasticSearch None of the configured nodes are available

another solution was to add network.bind_host: 0 to the yml - How to bind Elasticsearch 2.0 on both Loopback and Non-Loopback interfaces?

my firewall is turned off

non of these solutions worked for me. this should be super easy and the elastic search installation is brand new. what am I missing?

share your full java code. There are two ports used by Elasticsearch. The port 9200 provides access through http (eg your browser). The port 9300 is used for accessing Elasticsearch through the internal transport protocol, which is used by the Java transport client. check your firewall setting, may be port blocked by firewall.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM