# Add new relations after creating the mapping

**URL:** <https://discuss.elastic.co/t/add-new-relations-after-creating-the-mapping/144945>\
**Category:** Elasticsearch\
**Created:** [August 17, 2018, 6:27pm UTC](https://discuss.elastic.co/t/add-new-relations-after-creating-the-mapping/144945 "2018-08-17T18:27:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamash](https://avatars.discourse-cdn.com/v4/letter/i/a698b9/32.png) [@iamash](https://discuss.elastic.co/u/iamash)\
**Post date:** [August 17, 2018, 6:27pm UTC](https://discuss.elastic.co/t/add-new-relations-after-creating-the-mapping/144945/1 "2018-08-17T18:27:26Z")

</div>

Hi, I'm currently having the same question as [#103827](https://discuss.elastic.co/t/how-to-add-a-new-relation-to-an-existing-join-field/103827)  
Say I've already created a relation in the mapping:

> ```
> PUT my_index
> {
> "mappings": {
> "_doc": {
> "properties": {
> "my_join_field": { 
> "type": "join",
> "relations": {
> "question": "answer" 
> }
> }
> }
> }
> }
> }
> 
> ```

Now, if I want to add another child named "Comment" to the current parent question, is there any way that I can achieve this?  
I know that once you create the mapping, you cannot update it, but I also saw this on join dataytpe page:

 ![2018-08-17_1426](https://us1.discourse-cdn.com/elastic/original/3X/8/4/8495527b523ed3778b3ab89694a7aec08040a7c2.png)  
So please help

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [August 19, 2018, 9:46am UTC](https://discuss.elastic.co/t/add-new-relations-after-creating-the-mapping/144945/2 "2018-08-19T09:46:14Z")

</div>

I would expect the following to work, to update the mappings with the new `comment` child type:

```auto
PUT my_index/_mapping/_doc
{
  "properties": {
    "my_join_field": {
      "type": "join",
      "relations": {
        "question": [
          "answer",
          "comment"
        ]
      }
    }
  }
}

```

If you run into problems with this, please post the error messages that you're gettings and documents that cause problems.

---

<div class="post-metadata">

**Author:** ![iamash](https://avatars.discourse-cdn.com/v4/letter/i/a698b9/32.png) [@iamash](https://discuss.elastic.co/u/iamash)\
**Post date:** [August 20, 2018, 7:00pm UTC](https://discuss.elastic.co/t/add-new-relations-after-creating-the-mapping/144945/3 "2018-08-20T19:00:20Z")

</div>

It works! Thank you so much

---

<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:** [September 17, 2018, 7:08pm UTC](https://discuss.elastic.co/t/add-new-relations-after-creating-the-mapping/144945/4 "2018-09-17T19:08:46Z")

</div>

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