I am trying to use Aggregation API and for that documentation tells me to use
SearchResponse sr = node.client().prepareSearch() .setQuery( /* your query */ ) .addAggregation( /* add an aggregation */ ) .execute().actionGet();
But it does not tell me how to get the client object node.client()
RestHighLevelClient does not have a prepareSearch() method in 7.9.0. Then I tried upgrading to 7.12.1 but then I cannot find the class
at all. I am really confused. Am I missing a library? I am using two dependencies:
<dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>7.9.0</version> </dependency> <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>7.9.0</version> </dependency>
Also, the current documentation, e.g. Aggregations | Java API (deprecated) [7.12] | Elastic, states that the doc is deprecated. Another very confusing thing. Can anybody shed some light on this?