# Unable to connect to localhost elastic

**URL:** <https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875>\
**Category:** Elasticsearch\
**Created:** [March 14, 2018, 10:14am UTC](https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875 "2018-03-14T10:14:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmo2008](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kmo2008/32/28771_2.png) [@kmo2008](https://discuss.elastic.co/u/kmo2008)\
**Post date:** [March 14, 2018, 10:14am UTC](https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875/1 "2018-03-14T10:14:00Z")

</div>

Hi, I'm learning ElasticSearch, I have a problem with connecting to the database.

I install clear lastest elastic with clustername "kmo2008" without x-pack on basic license.

On web on localhsot:9200 gives:

```
{
"name": "localhost",
"cluster_name": "kmo2008",
"cluster_uuid": "F-3F-m5wQzOn-9G7I2-7Cg",
"version": {
"number": "6.2.2",
"build_hash": "10b1edd",
"build_date": "2018-02-16T19:01:30.685723Z",
"build_snapshot": false,
"lucene_version": "7.2.1",
"minimum_wire_compatibility_version": "5.6.0",
"minimum_index_compatibility_version": "5.0.0"
},
"tagline": "You Know, for Search"
}

```

Here is my code:

```
Settings settings = Settings.builder()
        .put("cluster.name", "kmo2008")
        .build();
TransportClient client = new PreBuiltTransportClient(settings)
        .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));

```

I tried with addres getByName("localhost") and i have the same error:

`Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{jwrZpNn6RX61_ZZFj9VBZQ}{127.0.0.1}{127.0.0.1:9300}]]`

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [March 14, 2018, 10:35am UTC](https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875/2 "2018-03-14T10:35:20Z")

</div>

Are you sure that you did not change the transport port in the elasticsearch.yml config file?

---

<div class="post-metadata">

**Author:** ![kmo2008](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kmo2008/32/28771_2.png) [@kmo2008](https://discuss.elastic.co/u/kmo2008)\
**Post date:** [March 14, 2018, 10:42am UTC](https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875/3 "2018-03-14T10:42:36Z")

</div>

My elastic config:

```
bootstrap.memory_lock: false
cluster.name: kmo2008
http.port: 9200
node.data: true
node.ingest: true
node.master: true
node.max_local_storage_nodes: 1
node.name: localhost
path.data: D:\Elsatic\6.2.2\data
path.logs: D:\Elsatic\6.2.2\logs
transport.tcp.port: 9300
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 14, 2018, 2:55pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875/4 "2018-03-14T14:55:35Z")

</div>

Not answering to your problem but FWIW I'd use the Rest Client instead: [https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html)

Anyway, what are the elasticsearch logs when it starts?

---

<div class="post-metadata">

**Author:** ![kmo2008](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kmo2008/32/28771_2.png) [@kmo2008](https://discuss.elastic.co/u/kmo2008)\
**Post date:** [March 14, 2018, 3:45pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875/5 "2018-03-14T15:45:34Z")

</div>

Ohh... i watch to last lines on elastic log and:

`java.lang.IllegalStateException: Received message from unsupported version: [5.0.0] minimal compatible version is: [5.6.0]`

i change veriosn of elastic dependency....

now its working 😉

Thank you for help 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 11, 2018, 3:45pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-localhost-elastic/123875/6 "2018-04-11T15:45:45Z")

</div>

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