Update mapping for geoip.location

Using Elasticsearch 2,2 I'm trying to update the field type for geoip.location (currently mapped as type 'number') to type geo_point using the following request:

myindex/_mapping/

{
  "properties": {
    "geoip.location": {
      "type": "geo_point"
    }
  }
}

Result is:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Field name [geoip.location] cannot contain '.'"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Field name [geoip.location] cannot contain '.'"
  },
  "status": 400
}

Any ideas how I can do this?

Something like:

{
  "properties": {
    "geoip": {
      "type": "object",
      "properties": {
         "location": {
             "type": "geo_point"
        }
    }
  }
}

That said, elasticsearch will refuse to do it as you can't change an existing field. You'll have to create a new field or type or index and reindex.

Ok, thanks. If I was to create a new template for this time based index, would it be like this?

{
    "template" : "myindex*",
    "settings" : {
        "number_of_shards" : 5
    },
"mappings": {
"properties" : {
"geoip": {
      "type": "object",
      "properties": {
         "location": {
             "type": "geo_point"
         }
       }
     }
   }
 }
}

Probably. I did not test it but it looks good.

Side note: please format your code when posting in discuss. It makes your posts more readable.