# ParsingException in Elastic 5.0.0

**URL:** <https://discuss.elastic.co/t/parsingexception-in-elastic-5-0-0/64626>\
**Category:** Elasticsearch\
**Created:** [November 1, 2016, 8:09pm UTC](https://discuss.elastic.co/t/parsingexception-in-elastic-5-0-0/64626 "2016-11-01T20:09:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_Gowda](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@Pradeep\_Gowda](https://discuss.elastic.co/u/Pradeep_Gowda)\
**Post date:** [November 1, 2016, 8:09pm UTC](https://discuss.elastic.co/t/parsingexception-in-elastic-5-0-0/64626/1 "2016-11-01T20:09:47Z")

</div>

Hi ,  
I am trying to run very simple query using Java client

```
        SearchRequestBuilder searchRequestBuilder;
        String query = "{\"query\":{\"match_all\":{}}}";
        searchRequestBuilder = client.prepareSearch("test_index51");
        searchRequestBuilder.setQuery(QueryBuilders.wrapperQuery(query));
        SearchResponse response = searchRequestBuilder.execute().actionGet();

```

But getting below exception

```
Exception in thread "main" Failed to execute phase [query], all shards failed; shardFailures {[dWHd87vtQc2Nyk2-Gs4F7A][test_index51][0]: RemoteTransportException[[dWHd87v][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: ParsingException[no [query] registered for [query]]; }{[dWHd87vtQc2Nyk2-Gs4F7A][test_index51][1]: RemoteTransportException[[dWHd87v][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: ParsingException[no [query] registered for [query]]; }{[dWHd87vtQc2Nyk2-Gs4F7A][test_index51][2]: RemoteTransportException[[dWHd87v][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: ParsingException[no [query] registered for [query]]; }{[dWHd87vtQc2Nyk2-Gs4F7A][test_index51][3]: RemoteTransportException[[dWHd87v][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: ParsingException[no [query] registered for [query]]; }{[dWHd87vtQc2Nyk2-Gs4F7A][test_index51][4]: RemoteTransportException[[dWHd87v][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: ParsingException[no [query] registered for [query]]; }
	at org.elasticsearch.action.search.AbstractSearchAsyncAction.onFirstPhaseResult(AbstractSearchAsyncAction.java:235)
	at org.elasticsearch.action.search.AbstractSearchAsyncAction$1.onFailure(AbstractSearchAsyncAction.java:170)
	at org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:51)
	at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:954)
	at org.elasticsearch.transport.TransportService$DirectResponseChannel.processException(TransportService.java:1055)
	at org.elasticsearch.transport.TransportService$DirectResponseChannel.sendResponse(TransportService.java:1033)
	at org.elasticsearch.transport.TransportService$6.onFailure(TransportService.java:559)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.onFailure(ThreadContext.java:490)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

```

but same query works through curl. How can I pass a query string in search request?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 1, 2016, 8:25pm UTC](https://discuss.elastic.co/t/parsingexception-in-elastic-5-0-0/64626/2 "2016-11-01T20:25:56Z")

</div>

I believe it is more like:

```java
        SearchRequestBuilder searchRequestBuilder;
        String query = "{\"match_all\":{}}";
        searchRequestBuilder = client.prepareSearch("test_index51");
        searchRequestBuilder.setQuery(QueryBuilders.wrapperQuery(query));
        SearchResponse response = searchRequestBuilder.execute().actionGet();

```

This is how it is [tested](https://github.com/elastic/elasticsearch/blob/5.0/core/src/test/java/org/elasticsearch/search/query/SearchQueryIT.java#L732-L745).

---

<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 5, 2017, 10:07pm UTC](https://discuss.elastic.co/t/parsingexception-in-elastic-5-0-0/64626/3 "2017-07-05T22:07:44Z")

</div>


