简体   繁体   中英

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)?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM