# Elasticsearch-2.0 parent-chid query returning empty results

**URL:** <https://discuss.elastic.co/t/elasticsearch-2-0-parent-chid-query-returning-empty-results/105138>\
**Category:** Elasticsearch\
**Created:** [October 25, 2017, 1:53am UTC](https://discuss.elastic.co/t/elasticsearch-2-0-parent-chid-query-returning-empty-results/105138 "2017-10-25T01:53:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zzalyp](https://avatars.discourse-cdn.com/v4/letter/z/0ea827/32.png) [@zzalyp](https://discuss.elastic.co/u/zzalyp)\
**Post date:** [October 25, 2017, 1:53am UTC](https://discuss.elastic.co/t/elasticsearch-2-0-parent-chid-query-returning-empty-results/105138/1 "2017-10-25T01:53:45Z")

</div>

I am using Elasticsearch version 2.0.0, query parent-child, but the result is empty, I do not know where the problem is, I refer to this example[https://stackoverflow.com/questions/29116935/elastic-search-parent-child-data-search-java-api](https://stackoverflow.com/questions/29116935/elastic-search-parent-child-data-search-java-api)

```
PUT bookstore
{
   "mappings": {
      "author": {
         "properties": {
            "authorname": {
               "type": "string"
            }
         }
      },
      "book": {
         "_parent": {
            "type": "author"
         },
         "properties": {
            "bookname": {
               "type": "string"
            }
         }
      }
   }
}

```

add two authors:

```
PUT bookstore/author/1
{
   "authorname": "author1"
}

PUT bookstore/author/2
{
   "authorname": "author2"
}

```

add two books of author author1:

```
PUT bookstore/book/11?parent=1
{
   "bookname": "book11"
}

PUT bookstore/book/12?parent=1
{
   "bookname": "book12"
}

```

add two books of author author2:

```
PUT bookstore/book/21?parent=2
{
   "bookname": "book21"
}

PUT bookstore/book/22?parent=2
{
   "bookname": "book22"
}

```

search result enter

 ![1](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5eb0295362bdfe27004695f127f2717ca9a2b800.png)

Ordinary query no problementer

 ![2](https://us1.discourse-cdn.com/elastic/original/3X/9/4/9430bbe549831540877c372fa77888b48f61d253.png)

---

<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:** [November 22, 2017, 1:53am UTC](https://discuss.elastic.co/t/elasticsearch-2-0-parent-chid-query-returning-empty-results/105138/2 "2017-11-22T01:53:51Z")

</div>

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