# QueryParsingException\[\[test\] \[has\_child\] Type \[revision\] does not have parent mapping\];

**URL:** https://discuss.elastic.co/t/queryparsingexception-test-has-child-type-revision-does-not-have-parent-mapping/3937
**Category:** Elasticsearch
**Created:** [February 17, 2011, 5:39am UTC](https://discuss.elastic.co/t/queryparsingexception-test-has-child-type-revision-does-not-have-parent-mapping/3937 "2011-02-17T05:39:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cwho](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cwho](https://discuss.elastic.co/u/cwho)
#### Post date: [February 17, 2011, 5:39am UTC](https://discuss.elastic.co/t/queryparsingexception-test-has-child-type-revision-does-not-have-parent-mapping/3937/1 "2011-02-17T05:39:33Z")

</div>

I am using ES 0.14.3.  
I'm trying to set up a parent child relationshpi between types  
"entity" and "revision". But search does not appear to be working -  
throws a QueryParsingException[[test] [has\_child] Type [revision]  
does not have parent mapping];

Below is what I used to reproduce this. Do I have to set up parent/  
child mappings somewhere?

e.g.:

# curl -XPOST '[http://localhost:9200/test/entity/1?pretty=true](http://localhost:9200/test/entity/1?pretty=true)' -d '{

> "myid" : "1",  
> "mydoctype" : "entity"  
> }  
> '  
> {  
> "ok" : true,  
> "\_index" : "test",  
> "\_type" : "entity",  
> "\_id" : "1"  
> }

# curl -XPOST '[http://localhost:9200/test/revision/2](http://localhost:9200/test/revision/2)?

parent=1&pretty=true' -d '{

> "myid" : "2",  
> "mydoctype" : "revision",  
> "myrevhead" : "1"  
> }  
> '  
> {  
> "ok" : true,  
> "\_index" : "test",  
> "\_type" : "revision",  
> "\_id" : "2"  
> }

# curl -XGET '[http://localhost:9200/test/\_search?pretty=true](http://localhost:9200/test/_search?pretty=true)' -d '{

> "from" : 0,  
> "size" : 10,  
> "query" : {  
> "has\_child" : {  
> "type" : "revision",  
> "query" : {  
> "term" : { "mydoctype" : "revision" }  
> }  
> }  
> }  
> }  
> '  
> {  
> "error" : "SearchPhaseExecutionException[Failed to execute phase  
> [query], total failure; shardFailures {[iAgSuwSZRoiszXvHTbpzRg][test]  
> [0]: SearchParseException[[test][0]: from[0],size[10]: Parse Failure  
> [Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :  
> {\n"has\_child" : {\n"type" : "revision",\n"query" : {\n"term  
> " : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:  
> QueryParsingException[[test] [has\_child] Type [revision] does not  
> have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][1]:  
> SearchParseException[[test][1]: from[0],size[10]: Parse Failure  
> [Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :  
> {\n"has\_child" : {\n"type" : "revision",\n"query" : {\n"term  
> " : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:  
> QueryParsingException[[test] [has\_child] Type [revision] does not  
> have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][2]:  
> SearchParseException[[test][2]: from[0],size[10]: Parse Failure  
> [Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :  
> {\n"has\_child" : {\n"type" : "revision",\n"query" : {\n"term  
> " : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:  
> QueryParsingException[[test] [has\_child] Type [revision] does not  
> have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][3]:  
> SearchParseException[[test][3]: from[0],size[10]: Parse Failure  
> [Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :  
> {\n"has\_child" : {\n"type" : "revision",\n"query" : {\n"term  
> " : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:  
> QueryParsingException[[test] [has\_child] Type [revision] does not  
> have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][4]:  
> SearchParseException[[test][4]: from[0],size[10]: Parse Failure  
> [Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :  
> {\n"has\_child" : {\n"type" : "revision",\n"query" : {\n"term  
> " : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:  
> QueryParsingException[[test] [has\_child] Type [revision] does not  
> have parent mapping]; }]"  
> }

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [February 17, 2011, 9:05am UTC](https://discuss.elastic.co/t/queryparsingexception-test-has-child-type-revision-does-not-have-parent-mapping/3937/2 "2011-02-17T09:05:14Z")

</div>

On Wed, 2011-02-16 at 21:39 -0800, cwho80 wrote:

> I am using ES 0.14.3.  
> I'm trying to set up a parent child relationshpi between types  
> "entity" and "revision". But search does not appear to be working -  
> throws a QueryParsingException[[test] [has\_child] Type [revision]  
> does not have parent mapping];
> 
> Below is what I used to reproduce this. Do I have to set up parent/  
> child mappings somewhere?

Yes you do, by creating a mapping. See  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/)

and specifically:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/parent-field.html)

clint

---

<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, 4:11am UTC](https://discuss.elastic.co/t/queryparsingexception-test-has-child-type-revision-does-not-have-parent-mapping/3937/3 "2017-07-06T04:11:55Z")

</div>


