Unable to connect to localhost elastic

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}]]

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

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

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

Anyway, what are the elasticsearch logs when it starts?

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 :wink:

Thank you for help :slight_smile:

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