# Update mapping to add new context to 'completion' type field

**URL:** <https://discuss.elastic.co/t/update-mapping-to-add-new-context-to-completion-type-field/236413>\
**Category:** Elasticsearch\
**Created:** [June 9, 2020, 8:04pm UTC](https://discuss.elastic.co/t/update-mapping-to-add-new-context-to-completion-type-field/236413 "2020-06-09T20:04:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sameersawant](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@sameersawant](https://discuss.elastic.co/u/sameersawant)\
**Post date:** [June 9, 2020, 8:04pm UTC](https://discuss.elastic.co/t/update-mapping-to-add-new-context-to-completion-type-field/236413/1 "2020-06-09T20:04:24Z")

</div>

I have a suggest mapping like so

```auto
    "mappings": {
        "item": {
          "dynamic": "false",
          "properties": {
            "name": {
              "type": "text",
            },
            "type": {
              "type": "keyword",
            },
             "suggest": {
              "type": "completion",
              "contexts": [
                {
                  "name" : "name_type",
                  "type" : "category",
                  "path" : "name"
                }
              ]
            }
          }
        }
    }

```

I want to update my mapping to add a new context to the "suggest" field which I am trying to do with a request body

```auto
    "properties": {
            "name": {
              "type": "text",
            },
            "type": {
              "type": "keyword",
            },
             "suggest": {
              "type": "completion",
              "contexts": [
                {
                  "name" : "name_type",
                  "type" : "category",
                  "path" : "name"
                },
               {
                  "name" : "t_type",
                  "type" : "category",
                  "path" : "type"
                }
              ]
            }
          }

```

But I get an error

```auto
    {
        "error": {
            "root_cause": [
                {
                    "type": "illegal_argument_exception",
                    "reason": "Mapper for [suggest] conflicts with existing mapping in other types:\n[mapper [suggest] has different [context_mappings] values]"
                }
            ],
            "type": "illegal_argument_exception",
            "reason": "Mapper for [suggest] conflicts with existing mapping in other types:\n[mapper [suggest] has different [context_mappings] values]"
        },
        "status": 400
    }

```

How do I add a new context to an existing completion field?

Thanks  
Sameer Sawant

---

<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 7, 2020, 8:04pm UTC](https://discuss.elastic.co/t/update-mapping-to-add-new-context-to-completion-type-field/236413/2 "2020-07-07T20:04:28Z")

</div>

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