# Parent-Child nested mapping

**URL:** <https://discuss.elastic.co/t/parent-child-nested-mapping/61214>\
**Category:** Elasticsearch\
**Created:** [September 22, 2016, 8:30am UTC](https://discuss.elastic.co/t/parent-child-nested-mapping/61214 "2016-09-22T08:30:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![edeak](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@edeak](https://discuss.elastic.co/u/edeak)\
**Post date:** [September 22, 2016, 8:30am UTC](https://discuss.elastic.co/t/parent-child-nested-mapping/61214/1 "2016-09-22T08:30:32Z")

</div>

Hi, I'd like to map the following structure:

- I have blog posts
- Blog posts can have comments
- Comments can have replies (which are also comments)

POST -----_--\> COMMENT  
COMMENT -----_---\> COMMENT

Here's what I tried:

```
mappings: {
    "comment": {
        "properties": {
            "content": { "type": "string" },
            "replies": { "type": "comment" }
        }
    },
    "post": {
        "properties": {
            "comments": {
                  "type": "comment"
             }
        }
    }
}

```

Of course it's not working. How can I achieve this?

---

<div class="post-metadata">

**Author:** ![edeak](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@edeak](https://discuss.elastic.co/u/edeak)\
**Post date:** [September 22, 2016, 9:41am UTC](https://discuss.elastic.co/t/parent-child-nested-mapping/61214/2 "2016-09-22T09:41:51Z")

</div>

See this solution for the problem on [stackoverflow](http://stackoverflow.com/a/39635381/912102)

---

<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:18pm UTC](https://discuss.elastic.co/t/parent-child-nested-mapping/61214/3 "2017-07-05T22:18:13Z")

</div>


