# How can I use queryBuilders.wrapperQuery base64 encoded string

**URL:** <https://discuss.elastic.co/t/how-can-i-use-querybuilders-wrapperquery-base64-encoded-string/157260>\
**Category:** Elasticsearch\
**Created:** [November 19, 2018, 2:54am UTC](https://discuss.elastic.co/t/how-can-i-use-querybuilders-wrapperquery-base64-encoded-string/157260 "2018-11-19T02:54:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![byeong\_seok\_park](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/byeong_seok_park/32/48056_2.png) [@byeong\_seok\_park](https://discuss.elastic.co/u/byeong_seok_park)\
**Post date:** [November 19, 2018, 2:54am UTC](https://discuss.elastic.co/t/how-can-i-use-querybuilders-wrapperquery-base64-encoded-string/157260/1 "2018-11-19T02:54:52Z")

</div>

I have a json string to build a query, and I need to convert this to QueryBuilder. (ES Ver. 6.3.0)

I found that I can use wrapperQuery method, so I wrote this code:

```
    String str = cond.getFilter().toString();
    QueryBuilder filter = QueryBuilders.boolQuery().must(QueryBuilders.wrapperQuery(str));

```

And these are result of variables in debug mode:

 ![err1](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4c8aed641c76002a3113441aa6bf5da9d1f35a7f.png)

And this method is working right, as the decription in the Docs([https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wrapper-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wrapper-query.html))

The problem is, that this query just not works.

 ![err2](https://us1.discourse-cdn.com/elastic/original/3X/7/3/7389500f12883f0fb2316ee5d3700d3d1dc666e9.png)

What is wrong and what should I do?

Any comments would be appreciated. Thanks.

---

<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:** [December 17, 2018, 3:03am UTC](https://discuss.elastic.co/t/how-can-i-use-querybuilders-wrapperquery-base64-encoded-string/157260/2 "2018-12-17T03:03:15Z")

</div>

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