# Attempting to reindex lat and lon as a geopoint using Dev Tools. Error: was expecting a colon to separate field name and value

**URL:** https://discuss.elastic.co/t/attempting-to-reindex-lat-and-lon-as-a-geopoint-using-dev-tools-error-was-expecting-a-colon-to-separate-field-name-and-value/186293
**Category:** Kibana
**Created:** [June 18, 2019, 3:08pm UTC](https://discuss.elastic.co/t/attempting-to-reindex-lat-and-lon-as-a-geopoint-using-dev-tools-error-was-expecting-a-colon-to-separate-field-name-and-value/186293 "2019-06-18T15:08:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![BenjaminHenry](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@BenjaminHenry](https://discuss.elastic.co/u/BenjaminHenry)
#### Post date: [June 18, 2019, 3:08pm UTC](https://discuss.elastic.co/t/attempting-to-reindex-lat-and-lon-as-a-geopoint-using-dev-tools-error-was-expecting-a-colon-to-separate-field-name-and-value/186293/1 "2019-06-18T15:08:21Z")

</div>

I am attempting to reindex data that was originally uploaded as individual lat and lon strings into a single geo\_point. In Dev Tools I attempted to use the following

```
POST _reindex
{
"source": {
"index": "ais_ben_test"
},
"dest": {
  "index": "ais_ben_geod"
 },
 "script": {
    "lang": "painless",
    "source": "ctx._source['GEO_POINT'] = ctx._source['LAT'] + ", " + ctx._source['LON']"
 }
}

```

I am getting the following error from my code

```
{ "error": {
"root_cause": [
  {
    "type": "x_content_parse_exception",
    "reason": "[10:67] [script] failed to parse object"
  }
],
"type": "x_content_parse_exception",
"reason": "[10:67] [reindex] failed to parse field [script]",
"caused_by": {
  "type": "x_content_parse_exception",
  "reason": "[10:67] [script] failed to parse object",
  "caused_by": {
    "type": "json_parse_exception",
    "reason": "Unexpected character ('}' (code 125)): was expecting a colon to separate field name and value\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@491171b5; line: 11, column: 4]"
  }
}

```

},  
"status": 400  
}

I have tried reformatting with a colon added at multiple areas of line 11 but none of my attempts have been successful. Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [June 21, 2019, 1:30pm UTC](https://discuss.elastic.co/t/attempting-to-reindex-lat-and-lon-as-a-geopoint-using-dev-tools-error-was-expecting-a-colon-to-separate-field-name-and-value/186293/2 "2019-06-21T13:30:09Z")

</div>

Make sure to set up the `ais_ben_geod` index before running the command to map your field as a [geo\_point](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html). Then you just need to escape the quotes around the comma. So the last line of your script will be `"source": "ctx._source['GEO_POINT'] = ctx._source['LAT'] + \", \" + ctx._source['LON']"`

```auto
PUT ais_ben_geod
{}

PUT ais_ben_geod/_mapping
{
  "properties": {
    "GEO_POINT": {
      "type": "geo_point"
    }
  }
}

POST _reindex
{
"source": {
"index": "ais_ben_test"
},
"dest": {
  "index": "ais_ben_geod"
 },
 "script": {
    "lang": "painless",
    "source": "ctx._source['GEO_POINT'] = ctx._source['LAT'] + \", \" + ctx._source['LON']"
 }
}

```

---

<div class="post-metadata">

### Author: ![BenjaminHenry](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@BenjaminHenry](https://discuss.elastic.co/u/BenjaminHenry)
#### Post date: [July 3, 2019, 7:18pm UTC](https://discuss.elastic.co/t/attempting-to-reindex-lat-and-lon-as-a-geopoint-using-dev-tools-error-was-expecting-a-colon-to-separate-field-name-and-value/186293/3 "2019-07-03T19:18:37Z")

</div>

Thanks! I ended up using a slightly different indexing method but your advice was spot on.

```auto
POST _reindex
{
  "source": {
    "index": "ais_2016_nov_zone11_enriched"
  },
  "dest": {
    "index": "ais_2016_nov_zone11_enriched2"
  },
  "script": {
    "inline": "ctx._source.GEO_POINT = ctx._source.LAT + ' , ' + ctx._source.LON"
  }
}

```

---

<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: [July 31, 2019, 7:32pm UTC](https://discuss.elastic.co/t/attempting-to-reindex-lat-and-lon-as-a-geopoint-using-dev-tools-error-was-expecting-a-colon-to-separate-field-name-and-value/186293/4 "2019-07-31T19:32:00Z")

</div>

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