How to update type of existing field to geo_point?

Hi I have an existing index which has location inside the property address which is like below -

"location" : {
              "properties" : {
                "lat" : {
                  "type" : "float"
                },
                "lon" : {
                  "type" : "float"
                }
              }
            },

But I wanted to convert it to geo_point and I tried with below code -

{
  "mappings": {
    "doc": {
      "properties": {
        "address.location": {
          "type": "geo_point"
        }
      }
    }
  }
}

and getting error -

{
  "error" : {
    "root_cause" : [
      {
        "type" : "resource_already_exists_exception",
        "reason" : "index [myIndex/jjUU55BJQrOb1GA4nvO3VA] already exists",
        "index_uuid" : "jjUU55BJQrOb1GA4nvO3VA",
        "index" : "myIndex"
      }
    ],
    "type" : "resource_already_exists_exception",
    "reason" : "index [myIndex/jjUU55BJQrOb1GA4nvO3VA] already exists",
    "index_uuid" : "jjUU55BJQrOb1GA4nvO3VA",
    "index" : "myIndex"
  },
  "status" : 400
}

can someone help me to update the type in existing field -

You can't update an existing field like this. You need to create another index and reindex.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.