# Error in wrapper query builder, java api, Highlevel client

**URL:** <https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984>\
**Category:** Elasticsearch\
**Created:** [May 8, 2018, 10:57am UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984 "2018-05-08T10:57:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![varun1992](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@varun1992](https://discuss.elastic.co/u/varun1992)\
**Post date:** [May 8, 2018, 10:57am UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984/1 "2018-05-08T10:57:09Z")

</div>

I got a error when passing a json query in WrapperQueryBuilder() method in java api. code as below

SearchResponse response = client.search(new SearchRequest(index)  
.source(  
new SearchSourceBuilder()  
.query(new WrapperQueryBuilder("{ "{ "bool": { "must": [{ "range": { "@timestamp": { "gte": "02-02-2018", "lte": "05-02-2018","format": "MM-dd-yyyy" } }}],"must\_not": [{"term": { "level.keyword": { "value":"Information" }}}]}}"  
))

)

i got error as below :  
There was an unexpected error (type=Internal Server Error, status=500).  
Chunk ["lte": "05-02-2018"] is not a valid entry

I need to add 2 filters in query section as json. 1st one for filtering the range and 2nd one for ignoring field value s "information". How can do it ?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [May 11, 2018, 9:19am UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984/2 "2018-05-11T09:19:39Z")

</div>

Hi,  
do you have the full stacktrace of that exception? Could you please post it?

---

<div class="post-metadata">

**Author:** ![varun1992](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@varun1992](https://discuss.elastic.co/u/varun1992)\
**Post date:** [May 11, 2018, 11:11am UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984/3 "2018-05-11T11:11:58Z")

</div>

error part of log as below

Date\_Histogram\_Format=MM-dd-YYYY,Date\_Histogram\_Interval=1d,Min\_Doc\_Count=1,Aggregation\_Type=DateHistogram\_Term\_Term,FilterQuery={ "bool": { "must": [{ "range": { "@timestamp": { "gte": "02-02-2018", "lte": "05-02-2018", "format": "MM-dd-yyyy" } }}],"must\_not": [{"term": { "level.keyword": { "value": "Information" } }}] }}  
2018-05-11 06:08:39,569 42928 [http-nio-9049-exec-1] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Returning handler method [java.lang.String com.smiforce.affero.host.rest.CommandReceiver.AggReceiver(java.lang.String) throws java.io.IOException]  
2018-05-11 06:08:39,570 42929 [http-nio-9049-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - Last-Modified value for [/affero-host/aggregation/Index=winlogbeat,Main\_Aggregation\_FieldName=@timestamp,Sub\_Aggregation\_FieldName=log\_name.keyword,Sub\_Aggregation\_FieldName2=level.keyword,Date\_Histogram\_Format=MM-dd-YYYY,Date\_Histogram\_Interval=1d,Min\_Doc\_Count=1,Aggregation\_Type=DateHistogram\_Term\_Term,FilterQuery=%7B%20%22bool%22:%20%7B%20%22must%22:%20[%20%7B%20%22range%22:%20%7B%20%22@timestamp%22:%20%7B%20%22gte%22:%20%2202-02-2018%22,%20%22lte%22:%20%2205-02-2018%22,%20%22format%22:%20%22MM-dd-yyyy%22%20%7D%20%7D%7D%20],%22must\_not%22:%20[%20%7B%22term%22:%20%7B%20%22level.keyword%22:%20%7B%20%22value%22:%20%22Information%22%20%7D%20%7D%7D%20]%20%7D%7D] is: -1  
2018-05-11 06:08:39,658 43017 [http-nio-9049-exec-1] DEBUG o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - Resolving exception from handler [java.lang.String com.smiforce.affero.host.rest.CommandReceiver.AggReceiver(java.lang.String) throws java.io.IOException]: java.lang.IllegalArgumentException: Chunk ["lte": "05-02-2018"] is not a valid entry  
2018-05-11 06:08:39,660 43019 [http-nio-9049-exec-1] DEBUG o.s.w.s.m.a.ResponseStatusExceptionResolver - Resolving exception from handler [java.lang.String com.smiforce.affero.host.rest.CommandReceiver.AggReceiver(java.lang.String) throws java.io.IOException]: java.lang.IllegalArgumentException: Chunk ["lte": "05-02-2018"] is not a valid entry  
2018-05-11 06:08:39,663 43022 [http-nio-9049-exec-1] DEBUG o.s.w.s.m.s.DefaultHandlerExceptionResolver - Resolving exception from handler [java.lang.String com.smiforce.affero.host.rest.CommandReceiver.AggReceiver(java.lang.String) throws java.io.IOException]: java.lang.IllegalArgumentException: Chunk ["lte": "05-02-2018"] is not a valid entry  
2018-05-11 06:08:39,698 43057 [http-nio-9049-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - Could not complete request  
java.lang.IllegalArgumentException: Chunk ["lte": "05-02-2018"] is not a valid entry

---

<div class="post-metadata">

**Author:** ![varun1992](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@varun1992](https://discuss.elastic.co/u/varun1992)\
**Post date:** [May 11, 2018, 11:13am UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984/4 "2018-05-11T11:13:17Z")

</div>

i am using spring gradle to do rest functionality.

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [May 11, 2018, 11:40am UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984/5 "2018-05-11T11:40:08Z")

</div>

I wonder if this error comes from Elasticsearch, do you see anything in the Elasticsearch logs? The logs that you have posted are from the client side as far as I understand.

---

<div class="post-metadata">

**Author:** ![varun1992](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@varun1992](https://discuss.elastic.co/u/varun1992)\
**Post date:** [May 11, 2018, 12:15pm UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984/6 "2018-05-11T12:15:34Z")

</div>

from where can i get elastic log ? location ?

---

<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:** [June 8, 2018, 12:15pm UTC](https://discuss.elastic.co/t/error-in-wrapper-query-builder-java-api-highlevel-client/130984/7 "2018-06-08T12:15:45Z")

</div>

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