elasticsearch 6.2.4 DSL java APIはデータを挿入して取得します.
1570 ワード
MAVENプロジェクトを作成して、mavenの依存は以下の通りです.
照会方法は以下の通りです.
org.elasticsearch
elasticsearch
6.2.4
org.elasticsearch.client
transport
6.2.4
照会方法は以下の通りです.
RestClient restClient = RestClient.builder(new HttpHost("192.168.43.22", 9200, "http")).build();
System.out.println(123);
Map params = new HashMap();
HttpEntity entity = new NStringEntity("{\"query\":{\"bool\":{\"must\":[{\"term\":{\"host.keyword\":\"media-for-the-masses.theacademyofperformingartsandscience.org\"}}],\"must_not\":[],\"should\":[]}},\"from\":0,\"size\":10,\"sort\":[],\"aggs\":{}}",
ContentType.APPLICATION_JSON);
Response response = restClient.performRequest("GET", "/logstash-2015.05.20/_search", params, entity);
System.out.println(EntityUtils.toString(response.getEntity()));
logstash-2015.05.20 ,json DSL json , head