# Parse Exception while executing has\_child query in Embedded Elastic Search Server

**URL:** <https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977>\
**Category:** Elasticsearch\
**Created:** [July 6, 2018, 7:48pm UTC](https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977 "2018-07-06T19:48:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shalini\_hemachandran](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@shalini\_hemachandran](https://discuss.elastic.co/u/shalini_hemachandran)\
**Post date:** [July 6, 2018, 7:48pm UTC](https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977/1 "2018-07-06T19:48:50Z")

</div>

Hi,

I am getting the following exception while executing a has\_child query in Embedded Elastic Search Server.

```auto
	at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:177)
	at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:526)
	at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:502)
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:409)
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:382)
	at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:323)
	at pan.apps.canary.historic_tag_manager.es.TagESManager.searchES(TagESManager.java:102)
	... 25 more
	Suppressed: org.elasticsearch.client.ResponseException: POST http://localhost:9205/malware/sample/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&search_type=dfs_query_then_fetch&batched_reduce_size=512: HTTP/1.1 400 Bad Request
{"error":{"root_cause":[{"type":"parsing_exception","reason":"no [query] registered for [has_child]","line":1,"col":87}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"dfs","grouped":true,"failed_shards":[{"shard":0,"index":"test","node":"6lyIguURRr6xfze5TFvDAA","reason":{"type":"parsing_exception","reason":"no [query] registered for [has_child]","line":1,"col":87}}]},"status":400}
		at org.elasticsearch.client.RestClient$1.completed(RestClient.java:354)
		at org.elasticsearch.client.RestClient$1.completed(RestClient.java:343)
		at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119)
		at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:177)
		at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:436)
		at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:326)
		at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
		at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
		at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
		at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
		at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
		at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
		at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
		at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
		at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
		at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
		at java.lang.Thread.run(Thread.java:748)

```

This happens only while using an embedded server.  
The following is the query used.

````auto
  "bool": {
    "filter": {
      "bool": {
        "must": [
          {
            "bool": {
              "must_not": {
                "has_child": {
                  "type": "sample_plus",
                  "filter": {
                    "terms": {
                      "tag": [
                        "abc"
                      ]
                    }
                  }
                }
              }
            }
          },
          {
            "bool": {
              "filter": {
                "term": {
                  "sample_id": "12345678"
                }
              }
            }
          }
        ]
      }
    }
  }
}```
````

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 6, 2018, 8:09pm UTC](https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977/2 "2018-07-06T20:09:23Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

Which version is your server?

> in Embedded Elastic Search Server

You can not run elasticsearch embedded. Read this [blog post](https://www.elastic.co/blog/elasticsearch-the-server).

---

<div class="post-metadata">

**Author:** ![shalini\_hemachandran](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@shalini\_hemachandran](https://discuss.elastic.co/u/shalini_hemachandran)\
**Post date:** [July 6, 2018, 10:47pm UTC](https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977/3 "2018-07-06T22:47:52Z")

</div>

Hi

Thank you for the feedback. I formatted the post.

I read the blog and totally understand why an embedded server is not supported.

But for unit tests and integration tests an embedded server comes in handy and seems like a better and useful option.

To answer your question, the elastic search version I am using is 5.6.4.

Also would you be able to share any embedded server equivalent which I can use to run a few integration tests in my application? My application uses RestHighLevelClient to interact with elastic search. Please do let me know if you need any more details.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 7, 2018, 3:55am UTC](https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977/4 "2018-07-07T03:55:09Z")

</div>

To run integration tests (not unit tests) you would probably prefer running that in something close to a production environment, like a real elasticsearch server instance. I shared some ideas about integration testing in this thread: [In memory testing with RestHighLevelClient](https://discuss.elastic.co/t/in-memory-testing-with-resthighlevelclient/106196/6)

Also this sample project shows how to use Elasticsearch Test Classes:

> **[joel-costigliola/elastic-search-test](https://github.com/joel-costigliola/elastic-search-test)**
>
> elastic-search-test - ESIntegTestCase example

---

<div class="post-metadata">

**Author:** ![shalini\_hemachandran](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@shalini\_hemachandran](https://discuss.elastic.co/u/shalini_hemachandran)\
**Post date:** [July 10, 2018, 6:07pm UTC](https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977/5 "2018-07-10T18:07:33Z")

</div>

Thank you for your response. I was able to fulfill my requirement using the elastic search maven plugin

---

<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:** [August 7, 2018, 6:07pm UTC](https://discuss.elastic.co/t/parse-exception-while-executing-has-child-query-in-embedded-elastic-search-server/138977/6 "2018-08-07T18:07:42Z")

</div>

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