# How to change the json objects mapping to geo\_point

**URL:** <https://discuss.elastic.co/t/how-to-change-the-json-objects-mapping-to-geo-point/205438>\
**Category:** Elasticsearch\
**Created:** [October 28, 2019, 10:30am UTC](https://discuss.elastic.co/t/how-to-change-the-json-objects-mapping-to-geo-point/205438 "2019-10-28T10:30:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![irobot678](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@irobot678](https://discuss.elastic.co/u/irobot678)\
**Post date:** [October 28, 2019, 10:30am UTC](https://discuss.elastic.co/t/how-to-change-the-json-objects-mapping-to-geo-point/205438/1 "2019-10-28T10:30:42Z")

</div>

HI,

i'm using elk stack of version 7.1.1 with x-pack installed

and I have follwing json data in elasticsearch

```
{
   "id":"someid",
   "geometry":{
      "type": "Point",
      "coordinates":[
         -76,
         -10
      ]
   },

```

and the mapping of this data is the following

```
   "geometry" : {
          "properties" : {
            "coordinates" : {
              "type" : "long"
            },
            "type" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },

```

so  
**How to change the geometry.coordinates type to geo\_point ?**

i tried the following and its showing errors

```
PUT jsongeo-maps/
{
 "mappings": {
      "geometry": {
        "properties":{
          "coordinates":{ "type": "geo_point" }
     }
    }
   } 
} 

```

and im getting the followwing errors :

```
"type": "resource_already_exists_exception",
    "reason": "index [jsongeo-maps/Ciit7Q1lQ8eqhcf32NDuhA] already exists",
    "index_uuid": "Ciit7Q1lQ8eqhcf32NDuhA",
    "index": "jsongeo-maps"
  },

```

so i deleted the index and added the mapping first then im getting the following error

```
{
      "error": {
        "root_cause": [
          {
            "type": "mapper_parsing_exception",
            "reason": "Root mapping definition has unsupported parameters: [geometry : {properties={coordinates={type=geo_point}}}]"
          }
        ],
        "type": "mapper_parsing_exception",
        "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [geometry : {properties={coordinates={type=geo_point}}}]",
        "caused_by": {
          "type": "mapper_parsing_exception",
          "reason": "Root mapping definition has unsupported parameters: [geometry : {properties={coordinates={type=geo_point}}}]"
        }
      },
      "status": 400
    }

```

Please help me solve it ?

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [October 29, 2019, 11:14am UTC](https://discuss.elastic.co/t/how-to-change-the-json-objects-mapping-to-geo-point/205438/2 "2019-10-29T11:14:33Z")

</div>

You were right that you had to delete the index first - it is not possible to change an existing mapping of a field. The reason the index creation with your mapping fails, is because the request is malformed. Try the following instead:

```auto
PUT jsongeo-maps/
{
  "mappings": {
    "properties": {
      "geometry": {
        "properties": {
          "coordinates": {
            "type": "geo_point"
          }
        }
      }
    }
  }
} 

```

---

<div class="post-metadata">

**Author:** ![irobot678](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@irobot678](https://discuss.elastic.co/u/irobot678)\
**Post date:** [November 5, 2019, 2:15pm UTC](https://discuss.elastic.co/t/how-to-change-the-json-objects-mapping-to-geo-point/205438/3 "2019-11-05T14:15:13Z")

</div>

Thanks @abdon it worked !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 3, 2019, 2:15pm UTC](https://discuss.elastic.co/t/how-to-change-the-json-objects-mapping-to-geo-point/205438/4 "2019-12-03T14:15:16Z")

</div>

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