Prabhakar Manthena
Prabhakar Manthena

Reputation: 2313

Elasticsearch mapping update for multifield

I just want to know is there any way to remove a field from mapping in elasticsearch?

Please find the below details so that you can understand what i am exactly trying to do.

Below is the script that i have used for creating an index with name test_index with mappings for type name with test_type.

    curl -XPUT 'http://elasticsearch_host:9200/test_index' -d '{
        "mappings": {
        "test_type": {
         "properties":{
            "field1":{
               "index":"not_analyzed",
               "type":"string"
            },
            "field2":{
               "properties":{
                 "sub_field1":{
                     "index":"not_analyzed",
                     "type":"string"
                  }, "sub_field2":{
                     "index":"not_analyzed",
                     "type":"string"
                  }
               }
            }
         }
    }
    }
}'

After executing the above script i can see the created index as per the mappings specified, And also i can be able to add new fields.

Here if wanted to remove sub_field2 from field2 properties in the mapping, Is there any way to do it (or is there any way to overwrite the entire field2 properties)?

Upvotes: 0

Views: 257

Answers (1)

Shalin LK
Shalin LK

Reputation: 190

It is not possible to change a mapping once it is created other than to add new fields. Re-indexing with zero down time describes why it is not possible and methods of re-indexing without down time.

Upvotes: 1

Related Questions