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

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

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.


   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

  QueryBuilders businessBoolQuery=...

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


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!

Hi @Bruce_Zu
I think you are looking for wrapper query.

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

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

1 Like

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