# Parse json query into querybuilder

**URL:** <https://discuss.elastic.co/t/parse-json-query-into-querybuilder/69358>\
**Category:** Elasticsearch\
**Created:** [December 18, 2016, 10:25am UTC](https://discuss.elastic.co/t/parse-json-query-into-querybuilder/69358 "2016-12-18T10:25:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Silvestre\_Losada](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@Silvestre\_Losada](https://discuss.elastic.co/u/Silvestre_Losada)\
**Post date:** [December 18, 2016, 10:25am UTC](https://discuss.elastic.co/t/parse-json-query-into-querybuilder/69358/1 "2016-12-18T10:25:20Z")

</div>

I have a javascript application with java backend. The application that submit json queries (not the hole object just the query part) tose queries are stored into database. I want to take those small queries and parse them as QueryQbuilder objects to put all of them together.

The kid of queries that I have are like this:

Query example 1

> ```
> {
> "bool": {
> "should": [
> {
> "term": {
> "Country Code": "BRA"
> }
> },
> {
> "term": {
> "Country Code": "ARG"
> }
> }
> ]
> }
> }
> 
> ```

Query example 2

> ```
> {
> "term": {
> "id": "3585"
> }
> }
> 
> ```

Query example 3

> {  
> "range": {  
> "age": {  
> "gte": 10,  
> "lte": 20,  
> "boost": 2.0  
> }  
> }  
> }

Is there any way to parse the subqueries into QueryBuilder object?

---

<div class="post-metadata">

**Author:** ![Silvestre\_Losada](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@Silvestre\_Losada](https://discuss.elastic.co/u/Silvestre_Losada)\
**Post date:** [January 12, 2017, 9:13am UTC](https://discuss.elastic.co/t/parse-json-query-into-querybuilder/69358/2 "2017-01-12T09:13:39Z")

</div>

I'm using wrapper queries to solve the issue.

---

<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:** [February 9, 2017, 9:14am UTC](https://discuss.elastic.co/t/parse-json-query-into-querybuilder/69358/3 "2017-02-09T09:14:30Z")

</div>

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