# QueryParser for Java

**URL:** <https://discuss.elastic.co/t/queryparser-for-java/22432>\
**Category:** Elasticsearch\
**Created:** [February 27, 2015, 1:31pm UTC](https://discuss.elastic.co/t/queryparser-for-java/22432 "2015-02-27T13:31:41Z")\
**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:31pm UTC](https://discuss.elastic.co/t/queryparser-for-java/22432/1 "2015-02-27T13:31:41Z")

</div>

Hi All,

I want to map queries from my UI as is to ES  
like for the below 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/b1dcf256-e97c-4d50-b199-a4006bac6498%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b1dcf256-e97c-4d50-b199-a4006bac6498%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/22432/2 "2017-07-06T00:29:30Z")

</div>


