Getting error to connect elasticsearch

Please go through the error log:
org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{XYMfUDMARnKNHCwWH4q9hg}{10.0.75.1}{10.0.75.1:9200}]
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 com.ge.trans.po.service.container.service.impl.claim.ClaimServiceImpl.updateQuery(ClaimServiceImpl.java:739)
at com.ge.trans.po.service.container.scheduler.EnvioContainerScheduler.runEnvioContainerScheduler(EnvioContainerScheduler.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

My application.yml look like this:

es:
host: 10.0.75.1
port: 9200
cluster: elasticsearch
index: po-app-data
accessMode: rest
protocol: http
enableMock: true
enabled: true
user: elastic
password: changeme
enableDefaultQueryClient: true

The Transport port is 9300 and not 9200. Fix your client code.

Note that you should use a Rest Client (in which case port 9200 is correct) instead of a Transport Client.

Hi @bhagyakopparala,
did you read the first line of the error log?

You app can not connect to Elasticsearch. Does something like curl http://10.0.75.1:9200 work?

Whenever we hit the URL in the browser ,It is workin and giving response as
{
"name" : "INLT1373",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "gg6KRe76Q2uBCZb5Ashnhg",
"version" : {
"number" : "5.6.10",
"build_hash" : "b727a60",
"build_date" : "2018-06-06T15:48:34.860Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}

whenever I hit the URL http://10.0.75.1:9200/_nodes am getting {"_nodes":{"total":1,"successful":1,"failed":0},"cluster_name":"elasticsearch","nodes":{"oQrMrVgCQKG84bb3xoOzwQ":{"name":"INLT1373","transport_address":"10.0.75.1:9300","host":"10.0.75.1","ip":"10.0.75.1","version":"5.6.10","build_hash":"b727a60","total_indexing_buffer":207775334,"roles":["master","data","ingest"],"attributes":{"ml.max_open_jobs":"10","ml.enabled":"true"},"settings":{"cluster":{"name":"elasticsearch"},"node":{"max_local_storage_nodes":"1","name":"INLT1373","attr":{"ml":{"max_open_jobs":"10","enabled":"true"}},"data":"true","ingest":"true","master":"true"},"path":{"conf":"D:\Elastic\config","data":["D:\Elastic\data"],"logs":"D:\Elastic\logs","home":"D:\Elastic"},"client":{"type":"node"},"http":{"type":{"default":"netty4"},"port":"9200"},"bootstrap":{"memory_lock":"false"},"transport":{"tcp":{"port":"9300"},"type":{"default":"netty4"}},"xpack":{"security":{"enabled":"false"}},"network":{"host":"0.0.0.0"}},"os":{"refresh_interval_in_millis":1000,"name":"Windows 10","arch":"amd64","version":"10.0","available_processors":8,"allocated_processors":8},"process":{"refresh_interval_in_millis":1000,"id":7380,"mlockall":false},"jvm":{"pid":7380,"version":"1.8.0_181","vm_name":"Java HotSpot(TM) 64-Bit Server VM","vm_version":"25.181-b13","vm_vendor":"Oracle Corporation","start_time_in_millis":1550139598278,"mem":{"heap_init_in_bytes":2147483648,"heap_max_in_bytes":2077753344,"non_heap_init_in_bytes":2555904,"non_heap_max_in_bytes":0,"direct_max_in_bytes":2077753344},"gc_collectors":["ParNew","ConcurrentMarkSweep"],"memory_pools":["Code Cache","Metaspace","Compressed Class Space","Par Eden Space","Par Survivor Space","CMS Old Gen"],"using_compressed_ordinary_object_pointers":"true","input_arguments":["-XX:+UseConcMarkSweepGC","-XX:CMSInitiatingOccupancyFraction=75","-XX:+UseCMSInitiatingOccupancyOnly","-XX:+AlwaysPreTouch","-Xss1m","-Djava.awt.headless=true","-Dfile.encoding=UTF-8","-Djna.nosys=true","-Djdk.io.permissionsUseCanonicalPath=true","-Dio.netty.noUnsafe=true","-Dio.netty.noKeySetOptimization=true","-Dio.netty.recycler.maxCapacityPerThread=0","-Dlog4j.shutdownHookEnabled=false","-Dlog4j2.disable.jmx=true","-Dlog4j.skipJansi=true","-XX:+HeapDumpOnOutOfMemoryError","-Xmx2048m","-Xms2048m","-Delasticsearch","-Des.path.home=D:\Elastic"]},"thread_pool":{"watcher":{"type":"fixed","min":40,"max":40,"queue_size":1000},"force_merge":{"type":"fixed","min":1,"max":1,"queue_size":-1},"ml_datafeed":{"type":"fixed","min":10,"max":10,"queue_size":200},"fetch_shard_started":{"type":"scaling","min":1,"max":16,"keep_alive":"5m","queue_size":-1},"listener":{"type":"fixed","min":4,"max":4,"queue_size":-1},"ml_autodetect":{"type":"fixed","min":40,"max":40,"queue_size":40},"index":{"type":"fixed","min":8,"max":8,"queue_size":200},"refresh":{"type":"scaling","min":1,"max":4,"keep_alive":"5m","queue_size":-1},"generic":{"type":"scaling","min":4,"max":128,"keep_alive":"30s","queue_size":-1},"warmer":{"type":"scaling","min":1,"max":4,"keep_alive":"5m","queue_size":-1},"search":{"type":"fixed","min":13,"max":13,"queue_size":1000},"flush":{"type":"scaling","min":1,"max":4,"keep_alive":"5m","queue_size":-1},"fetch_shard_store":{"type":"scaling","min":1,"max":16,"keep_alive":"5m","queue_size":-1},"management":{"type":"scaling","min":1,"max":5,"keep_alive":"5m","queue_size":-1},"ml_utility":{"type":"fixed","min":40,"max":40,"queue_size":500},"get":{"type":"fixed","min":8,"max":8,"queue_size":1000},"bulk":{"type":"fixed","min":8,"max":8,"queue_size":200},"snapshot":{"type":"scaling","min":1,"max":4,"keep_alive":"5m","queue_size":-1}},"transport":{"bound_address":["[::]:9300"],"publish_address":"10.0.75.1:9300","profiles":{}},"http":{"bound_address":["[::]:9200"],"publish_address":"10.0.75.1:9200","max_content_length_in_bytes":104857600},"plugins":[{"name":"lang-python","version":"5.6.10","description":"The Python language plugin allows to have python as the language of scripts to execute.","classname":"org.elasticsearch.plugin.python.PythonPlugin","has_native_controller":false},{"name":"x-pack","version":"5.6.10","description":"Elasticsearch Expanded Pack Plugin","classname":"org.elasticsearch.xpack.XPackPlugin","has_native_controller":true}],"modules":[{"name":"aggs-matrix-stats","version":"5.6.10","description":"Adds aggregations whose input are a list of numeric fields and output includes a matrix.","classname":"org.elasticsearch.search.aggregations.matrix.MatrixAggregationPlugin","has_native_controller":false},{"name":"ingest-common","version":"5.6.10","description":"Module for ingest processors that do not require additional security permissions or have large dependencies and resources","classname":"org.elasticsearch.ingest.common.IngestCommonPlugin","has_native_controller":false},{"name":"lang-expression","version":"5.6.10","description":"Lucene expressions integration for Elasticsearch","classname":"org.elasticsearch.script.expression.ExpressionPlugin","has_native_controller":false},{"name":"lang-groovy","version":"5.6.10","description":"Groovy scripting integration for Elasticsearch","classname":"org.elasticsearch.script.groovy.GroovyPlugin","has_native_controller":false},{"name":"lang-mustache","version":"5.6.10","description":"Mustache scripting integration for Elasticsearch","classname":"org.elasticsearch.script.mustache.MustachePlugin","has_native_controller":false},{"name":"lang-painless","version":"5.6.10","description":"An easy, safe and fast scripting language for Elasticsearch","classname":"org.elasticsearch.painless.PainlessPlugin","has_native_controller":false},{"name":"parent-join","version":"5.6.10","description":"This module adds the support parent-child queries and aggregations","classname":"org.elasticsearch.join.ParentJoinPlugin","has_native_controller":false}

As I said, you are using a TransportClient not a RestClient. You need to change that or use the 9300 port and set the cluster name.

ok thank you

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