# Porting to High Level Rest Client

**URL:** <https://discuss.elastic.co/t/porting-to-high-level-rest-client/123166>\
**Category:** Elasticsearch\
**Created:** [March 9, 2018, 12:08am UTC](https://discuss.elastic.co/t/porting-to-high-level-rest-client/123166 "2018-03-09T00:08:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![questar](https://avatars.discourse-cdn.com/v4/letter/q/9fc29f/32.png) [@questar](https://discuss.elastic.co/u/questar)\
**Post date:** [March 9, 2018, 12:08am UTC](https://discuss.elastic.co/t/porting-to-high-level-rest-client/123166/1 "2018-03-09T00:08:40Z")

</div>

The transport client supports the following Elastic example:

AggregationBuilder aggregation =  
AggregationBuilders  
.significantTerms("significant\_countries")  
.field("address.country");

```
		SearchResponse sr = client.prepareSearch()
		        .setQuery(QueryBuilders.termQuery("gender", "male"))
		        .addAggregation(aggregation)
		        .get();

```

I cannot locate in the REST client a point where .setQuery() can be invoked.  
My objective is to establish an overall query for a multi-bucket aggregation.

Thanks

---

<div class="post-metadata">

**Author:** ![questar](https://avatars.discourse-cdn.com/v4/letter/q/9fc29f/32.png) [@questar](https://discuss.elastic.co/u/questar)\
**Post date:** [March 9, 2018, 1:53pm UTC](https://discuss.elastic.co/t/porting-to-high-level-rest-client/123166/2 "2018-03-09T13:53:39Z")

</div>

searchSourceBuilder.query(QueryBuilders.boolQuery());  
for example

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 6, 2018, 1:53pm UTC](https://discuss.elastic.co/t/porting-to-high-level-rest-client/123166/3 "2018-04-06T13:53:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
