这是我的elasticsearch网址: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。