线程“主”中的异常org.elasticsearch.client.transport.NoNodeAvailableException:没有节点可用 [英] Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: No node available

查看:654
本文介绍了线程“主”中的异常org.elasticsearch.client.transport.NoNodeAvailableException:没有节点可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试索引使用下面的Java代码在弹性搜索..
我给我的机器Ip在代码中。它无法连接到节点。
它正在给出如下错误:



线程main中的异常org.elasticsearch.client.transport.NoNodeAvailableException:无节点可用
at
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:219)
在org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
在org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:82)
在org.elasticsearch.client.transport.TransportClient.index(TransportClient.java:330)
(org.elasticsearch.index.IndexRequestBuilder.doExecute .ActionRequestBuilder.execute(ActionRequestBuilder.java:59)
在test.test1.main(test1.java:30)



代码I我正在使用:

  public static void main(String [] args){

String json = {+
\user\:\AMaresh\,+
\postDate\:\2014-04-23\ ,+
\message\:\试试Elasticsearch \+
};


设置设置= ImmutableSettings.settingsBuilder()。put(elasticsearch,elasticsearch)。build();
TransportClient transportClient = new TransportClient(settings);

客户端client = new TransportClient()。addTransportAddress(new InetSocketTransportAddress(10.210.51.207,9300));

IndexResponse response = client.prepareIndex(Cricket,cric,1)。setSource(json).execute()。actionGet();
//列表< String> matches = response.matches();
System.out.println(response);
System.out.println(finished);

我已经检查了端口在机器中打开。



/ p>

解决方案



div>

我认为问题提到集群名称..使用以下

 设置设置= ImmutableSettings.settingsBuilder() 
.put(cluster.name,elasticsearch)。build();

希望它有帮助..!


I am trying index using below Java code in elastic search.. I gave my machine Ip in the code .It is unable to connect to node. It is giving error like below :

Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: No node available at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:219) at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106) at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:82) at org.elasticsearch.client.transport.TransportClient.index(TransportClient.java:330) at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(IndexRequestBuilder.java:314) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85) at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59) at test.test1.main(test1.java:30)

Code I am using:

public static void main(String[] args) {

    String json = "{" +         
                    "\"user\":\"AMaresh\"," +         
                    "\"postDate\":\"2014-04-23\"," + 
                    "\"message\":\"trying out Elasticsearch\"" +
                    "}";  


    Settings settings = ImmutableSettings.settingsBuilder().put("elasticsearch", "elasticsearch").build();
    TransportClient transportClient = new TransportClient(settings);

    Client client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("10.210.51.207",9300));

    IndexResponse response = client.prepareIndex("Cricket", "cric", "1").setSource(json).execute().actionGet();
    //List<String> matches = response.matches();
    System.out.println(response);
    System.out.println("finished");

I have checked ports are open in the machine.

Can anybody help me understanding the problem.

Thanks in advance

解决方案

I think the problem in mentioning cluster name.. Use lik following

    Settings settings =               ImmutableSettings.settingsBuilder()
   .put("cluster.name", "elasticsearch").build();

Hope it helps..!

这篇关于线程“主”中的异常org.elasticsearch.client.transport.NoNodeAvailableException:没有节点可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆