[英]ElasticSearch (java) - Nodes not configured issue
我正在嘗試最基本的情況來連接到我的ES群集,但是看來我注冊的主機沒有被注冊。 這是我正在運行的代碼:
//Create the client
Client client = new TransportClient(ImmutableSettings.builder()
.put("cluster.name", "MyCluster")
.put("client.transport.sniff","true").build())
.addTransportAddresses(
new InetSocketTransportAddress("host1", 9300),
new InetSocketTransportAddress("host2", 9300));
// Try to make a call
SearchRequest sr = new SearchRequest().indices("MyIndex");
ActionFuture<SearchResponse> search = client.search(sr);
SearchResponse actionGet = search.actionGet(); // <-- Exception
System.out.println(actionGet.toString());
client.close();
這是我得到的例外:
線程“主要” org.elasticsearch.client.transport.NoNodeAvailableException中的異常:
沒有配置的節點可用:[]
看起來沒有連接的節點,我缺少什么?
注意:我正在使用gradle的彈性搜索客戶端:
編譯'org.elasticsearch:elasticsearch:1.7.5'
有一些可能的原因:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.