# Is there some parse API in ES Java High Level REST Client?

**URL:** <https://discuss.elastic.co/t/is-there-some-parse-api-in-es-java-high-level-rest-client/308397>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 28, 2022, 8:06pm UTC](https://discuss.elastic.co/t/is-there-some-parse-api-in-es-java-high-level-rest-client/308397 "2022-06-28T20:06:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruce\_Zu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruce_zu/32/107211_2.png) [@Bruce\_Zu](https://discuss.elastic.co/u/Bruce_Zu)\
**Post date:** [June 28, 2022, 8:06pm UTC](https://discuss.elastic.co/t/is-there-some-parse-api-in-es-java-high-level-rest-client/308397/1 "2022-06-28T20:06:36Z")

</div>

Hi ES Java High Level REST Client team,  
I am using ES Java High Level REST Client 6.8.0 version.  
I want to know whether there is some function, like the JSON parser, to be able to covert String type query to `QueryBuilder` object. The String type query is the result of running the `toString() ` method of `AbstractQueryBuilder` by some XXQueryBuilder object

E.g.  
In our case, there is a microservice providing ACL ES query string which will be used by end user as a part of an ES query, to be as an ACL condition.

E.g.:

```auto
   QueryBuilders aclBoolQuery = QueryBuilders.boolQuery()
                    .must(QueryBuilders.termQuery("A", "RF"))
                    .must(QueryBuilders.termQuery("B", "EF"))
                    .must(QueryBuilders.termQuery("C", "RF"));
return aclBoolQuery.toString(false);

```

In another microservice to consume the string type query

```auto
  QueryBuilders businessBoolQuery=...

  String aclBoolQuery=rpcClient.callAclService(aclRequest);
  QueryBuilder acl= QueryBuilders.parse(aclBoolQuery); // expected function

  businessBoolQuery.filter(acl);
  ...

```

It is easily to use by Python client. But for ES Java High Level REST Client I can not find any API that can parse the query string.

I guess it should be somewhere or there should be a good reason without providing this feature.

Thank you!  
Bruce

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [June 29, 2022, 12:27pm UTC](https://discuss.elastic.co/t/is-there-some-parse-api-in-es-java-high-level-rest-client/308397/2 "2022-06-29T12:27:53Z")

</div>

Hi @Bruce_Zu  
I think you are looking for [wrapper query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wrapper-query.html).

```auto
new SearchSourceBuilder().query(QueryBuilders.wrapperQuery("json_query"));

```

---

<div class="post-metadata">

**Author:** ![Bruce\_Zu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruce_zu/32/107211_2.png) [@Bruce\_Zu](https://discuss.elastic.co/u/Bruce_Zu)\
**Post date:** [June 29, 2022, 9:35pm UTC](https://discuss.elastic.co/t/is-there-some-parse-api-in-es-java-high-level-rest-client/308397/3 "2022-06-29T21:35:28Z")

</div>

@RabBit_BR  
Thank you so much for shedding light here!  
That is just what I want. Awesome feature!  
/Bruce

---

<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:** [July 27, 2022, 9:35pm UTC](https://discuss.elastic.co/t/is-there-some-parse-api-in-es-java-high-level-rest-client/308397/4 "2022-07-27T21:35:52Z")

</div>

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