Elasticsearch-如何使用类型从Elasticsearch获取所有记录

时间:2018-06-25 10:38:15

标签: elasticsearch elasticsearch-plugin

这是我的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。

0 个答案:

没有答案