Remove/Unmap a field alias


(GBP) #1

Hi,

I am using Elasticsearch 6.5 to create alias datatypes to fields (https://www.elastic.co/guide/en/elasticsearch/reference/current/alias.html).

For e.g. I have this mapping

{
  "mappings": {
    "_doc": {
      "properties": {
        "distance": {
          "type": "long"
        },
        "route_length_miles": {
          "type": "alias",
          "path": "distance" 
        }
      }
    }
  }
}

Is there a way I can remove/unmap 'route_length_miles' from pointing to 'distance'? When field aliases are created, there doesn't seem to be a way to remove them unless the index itself is deleted (which is not a viable solution)

Thanks


(Junaid) #2

Unfortunately you'll have to reindex the documents. There isn't any way to delete an existing mapping, you can create a new mapping though using PUT _mapping call.


(GBP) #3

Its pity that it can't be done for aliases though, as the aliases are just pointers to actual fields and can be re-pointed to different fields easily but cannot be unmapped once created.