# Transport client 5.0.0 cannot query using the JSON DSL (works via HTTP though)

**URL:** <https://discuss.elastic.co/t/transport-client-5-0-0-cannot-query-using-the-json-dsl-works-via-http-though/74733>\
**Category:** Elasticsearch\
**Created:** [February 11, 2017, 2:02am UTC](https://discuss.elastic.co/t/transport-client-5-0-0-cannot-query-using-the-json-dsl-works-via-http-though/74733 "2017-02-11T02:02:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![amrk7](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@amrk7](https://discuss.elastic.co/u/amrk7)\
**Post date:** [February 11, 2017, 2:02am UTC](https://discuss.elastic.co/t/transport-client-5-0-0-cannot-query-using-the-json-dsl-works-via-http-though/74733/1 "2017-02-11T02:02:18Z")

</div>

Hi, We were using elasticsearch 2.1.0 till now and the following construct was supported

```
client.prepareSearch(index).setSource(<jsonQuery>)

```

As per the new elasticsearch 5.0.0 documentation, this is removed in favour of #setQuery(). This is not working for most of the queries involving 'aggregations'.

```
client.prepareSearch(index) .setQuery(wrapperQuery(jsonQuery);

```

The wrapper query just seem to wrap the entire json inside a 'query' field. But potentially 'jsonQuery' can have aggregations etc.

Is there any other ways with which this is possible?

---

<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:** [March 11, 2017, 2:02am UTC](https://discuss.elastic.co/t/transport-client-5-0-0-cannot-query-using-the-json-dsl-works-via-http-though/74733/2 "2017-03-11T02:02:27Z")

</div>

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