0

最も基本的なケースで 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 でエラスティック検索クライアントを使用しています:
compile 'org.elasticsearch:elasticsearch:1.7.5'

4

1 に答える 1