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

I have a suggest mapping like so

    "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

    "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

    {
        "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

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