简体   繁体   中英

Elastic Search - How to update mapping field from keyword to text

{
   "properties":{
      "device":{
         "type":"object",
         "properties":{
            "id":{
               "type":"keyword"
            },
            "value":{
               "type":"keyword"
            }
         }
      }
   }
}

I wanted to update mapping value as text, when I'm trying to update using https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html throws an error. "mapper [device.value] of different type, current_type [keyword], merged_type [text]"

{
   "properties":{
      "device":{
         "type":"object",
         "properties":{
            "id":{
               "type":"keyword"
            },
            "value":{
               "type":"text"
            }
         }
      }
   }
}

Someone help me update index from keyword to text?

Changing field type is a breaking change, you need to

  1. Create a new index with new required mapping.

  2. use reindex API to move data from old to new index(optional if you are OK with data loss)

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