# QueryParser for Java

**URL:** <https://discuss.elastic.co/t/queryparser-for-java/22431>\
**Category:** Elasticsearch\
**Created:** [February 27, 2015, 1:26pm UTC](https://discuss.elastic.co/t/queryparser-for-java/22431 "2015-02-27T13:26:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Hora](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amit_hora/32/45312_2.png) [@Amit\_Hora](https://discuss.elastic.co/u/Amit_Hora)\
**Post date:** [February 27, 2015, 1:26pm UTC](https://discuss.elastic.co/t/queryparser-for-java/22431/1 "2015-02-27T13:26:26Z")

</div>

Hi All,

I want to map queries for my UI as is to ES  
like for the below query  
{  
"query": {  
"filtered": {  
"filter": {  
"range": {  
"ISMobileNumber": {  
"lt": 8332453735  
}  
}  
}  
}  
},  
"aggs" : {  
"single\_avg\_price": {  
"avg" : { "field" : "ISMobileNumber" }  
}  
}  
}

when i do the following  
searchResponse =  
transportClient.prepareSearch("ind1").addField("ISMobileNumber")  
.setTypes("type")  
.setQuery(new  
String(Files.readAllBytes(Paths.get("/home/ESDocs/Query/Query4.txt"))))  
.setSize(scrollSize)  
.setFrom(j\*scrollSize)  
.execute()  
.actionGet();

i am not able to aggregate i have to add them seperatly by doing  
.addAggregation(),is there any way by which i can pass the entire query as  
a string and get the output

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2abb261d-a166-48f7-97df-aa4517ffc92e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2abb261d-a166-48f7-97df-aa4517ffc92e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:29am UTC](https://discuss.elastic.co/t/queryparser-for-java/22431/2 "2017-07-06T00:29:30Z")

</div>


