Parent-Child nested mapping

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?

See this solution for the problem on stackoverflow