Update mapping of not_analyzed field

Hi @butsjoh,

the error message says:

mapper [field2] has different [omit_norms] values, cannot change from disable to enabled

You (implicitly) try to enable norms after the fact which is not possible, see the user docs on norms for more information.

You can also see all index settings with the get field mapping API:

GET /my_index/_mapping/test/field/field2?include_defaults=true

Basically, you need to keep the index options (which means, keeping field2 and not_analyzed), then everything works fine:

PUT my_index/_mapping/test
{
   "properties": {
      "field2": {
         "type": "string",
         "index": "not_analyzed",
         "fields": {
            "raw": {
               "type": "string",
               "index": "not_analyzed"
            },
            "search": {
               "type": "string"
            }
         }
      }
   }
}

If you don't want to do that, you need to create a new index and reindex the data from the old index.

Daniel

3 Likes