这是我的elasticsearch url:http://localhost:9200/college/dep/_search?q= *如何使用java API读取所有数据 . 其实我试过下面的代码 .
Client client;
try {
Node node;
node = nodeBuilder().clusterName("elasticsearch").node();
client = TransportClient.builder().build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300));
System.out.println(client);
SearchResponse searchResponse = client.prepareSearch("college").setTypes("dep").execute().actionGet();
SearchHit[] hits = searchResponse.getHits().getHits();
System.out.println(hits.length);
} catch (Exception e) {
System.out.println(e);
}
它是说java.lang.IllegalStateException:没有配置path.home .