# Dynamically update mapping values

**URL:** <https://discuss.elastic.co/t/dynamically-update-mapping-values/109527>\
**Category:** Elasticsearch\
**Created:** [November 29, 2017, 7:37am UTC](https://discuss.elastic.co/t/dynamically-update-mapping-values/109527 "2017-11-29T07:37:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prabhu\_pandurangan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prabhu_pandurangan/32/24363_2.png) [@prabhu\_pandurangan](https://discuss.elastic.co/u/prabhu_pandurangan)\
**Post date:** [November 29, 2017, 7:37am UTC](https://discuss.elastic.co/t/dynamically-update-mapping-values/109527/1 "2017-11-29T07:37:20Z")

</div>

Hi Team,

Below is my index mapping & i need to map 'has\_impact' property from 'key\_mapping' to the property in 'template\_mapping' during run\_time.

How do i achieve that? Appreciate your help.

```auto
{
  "index-name": {
    "mappings": {
      "key_mapping": {
        "dynamic_templates": [
          {
            "strings": {
              "match_mapping_type": "string",
              "mapping": {
                "index": true,
                "type": "keyword"
              }
            }
          }
        ],
        "properties": {
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "keyword"
          },
          "has_impact": {
            "type": "long"
          },
          "values": {
            "properties": {
              "alertKey": {
                "type": "keyword"
              }
            }
          }
        }
      },
      "template_mapping": {
        "dynamic_templates": [
          {
            "strings": {
              "match_mapping_type": "string",
              "mapping": {
                "index": true,
                "type": "keyword"
              }
            }
          }
        ],
        "properties": {
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "keyword"
          },
          "has_impact": {
            "type": "long"
          },
          "values": {
            "properties": {
              "alertKey": {
                "type": "keyword"
              }
            }
          }
        }
      },
      "_default_": {
        "dynamic_templates": [
          {
            "strings": {
              "match_mapping_type": "string",
              "mapping": {
                "index": true,
                "type": "keyword"
              }
            }
          }
        ],
        "properties": {
          "timestamp": {
            "type": "date",
            "format": "epoch_millis||date_time"
          },
          "values": {
            "properties": {
              "code": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 29, 2017, 7:43am UTC](https://discuss.elastic.co/t/dynamically-update-mapping-values/109527/2 "2017-11-29T07:43:14Z")

</div>

You should really change your mappings, multiple types are not supported in Elasticsearch 6.0.

Have a single type and then just move the `key_mapping` and `template_mapping` to a field of their own.

---

<div class="post-metadata">

**Author:** ![prabhu\_pandurangan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prabhu_pandurangan/32/24363_2.png) [@prabhu\_pandurangan](https://discuss.elastic.co/u/prabhu_pandurangan)\
**Post date:** [November 29, 2017, 5:40pm UTC](https://discuss.elastic.co/t/dynamically-update-mapping-values/109527/3 "2017-11-29T17:40:06Z")

</div>

Ok. But the intention here, source of data for key\_mapping & template\_mapping are different, that is the reason i was checking here, is it possible to sync or update the attribute values between mappings.

Can you please give more details in what you explained in ur response?

---

<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:** [December 27, 2017, 5:40pm UTC](https://discuss.elastic.co/t/dynamically-update-mapping-values/109527/4 "2017-12-27T17:40:23Z")

</div>

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