I am facing this error while implementing elastic search in spring boot.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loaders': Invocation of init method failed; nested exception is NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{FzaWEy4gQTeGXw04FAe5HQ}{127.0.0.1}{127.0.0.1:9200}]]
Here is the command im running
docker run -d -p 9200:9200 --name elasticsearch_test docker.elastic.co/elasticsearch/elasticsearch:6.5.4 elasticsearch -Enetwork.publish_host="localhost" -Etransport.publish_port="9200"
Here is node Log
{
"_nodes": {
"total": 1,
"successful": 1,
"failed": 0
},
"cluster_name": "docker-cluster",
"nodes": {
"-R2MlL29RdOzYYiAzKkrBQ": {
"name": "-R2MlL2",
"transport_address": "127.0.0.1:9200",
"host": "localhost",
"ip": "127.0.0.1",
"version": "6.5.4",
"build_flavor": "default",
"build_type": "tar",
"build_hash": "d2ef93d",
"roles": [
"master",
"data",
"ingest"
],
"attributes": {
"ml.machine_memory": "2076532736",
"xpack.installed": "true",
"ml.max_open_jobs": "20",
"ml.enabled": "true"
},
"http": {
"bound_address": [
"0.0.0.0:9200"
],
"publish_address": "127.0.0.1:9200",
"max_content_length_in_bytes": 104857600
}
}
}
}
Here is my Configurations code
public TransportClient client() throws UnknownHostException{
final Settings esSettings = Settings.builder().put("cluster.name", "docker-cluster").build();
client = new PreBuiltTransportClient(esSettings);
client.addTransportAddress(new TransportAddress(InetAddress.getByName("127.0.0.1"), 9200));
return client;
}
And here is the Error point
public void loadAll() throws UnknownHostException {
TransportClient client = esconf.client();
ElasticsearchTemplate esTemplate = new ElasticsearchTemplate(client);
esTemplate.createIndex("testindex");
}
Error is at the point where im creating index.
I have been through alot of links but no help.
Any help will be appreciated. Thanks