# How can I generate lat long fields into geo point in elasticsearch

**URL:** https://discuss.elastic.co/t/how-can-i-generate-lat-long-fields-into-geo-point-in-elasticsearch/312329
**Category:** Elasticsearch
**Tags:** painless
**Created:** [August 18, 2022, 12:15am UTC](https://discuss.elastic.co/t/how-can-i-generate-lat-long-fields-into-geo-point-in-elasticsearch/312329 "2022-08-18T00:15:39Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 18, 2022, 4:17am UTC](https://discuss.elastic.co/t/how-can-i-generate-lat-long-fields-into-geo-point-in-elasticsearch/312329/4 "2022-08-18T04:17:42Z")

</div>

Yes I was thinking that.. but you asked about a painless script so that is the answer you got 🙂 That painless script will update all the documents...

Perhaps look at this thread... the last couple posts (It is a bit long... but the OP is loading Geo Data from Postgres using Logstash)

Last Couple Posts..

> [@Layer dot found result](https://discuss.elastic.co/t/layer-dot-found-result/312028/27):
>
> sorry @stephenb at the beginning I created my mapping as follows: PUT jeudi { "mappings": { "properties": { "id": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore\_above": 256 } } }, "location": { "type": "geo\_point" }, "nom": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore\_above": 256 …

I do not know `pgsync`... but in the end you just need to put the lat / lon in the right fields... I would think you would be able to do that... I just not familiar with the tool

Looks to me like you will need to use the transform node rename logic to [rename](https://pgsync.com/tutorial/transform-nodes/#rename) your source fields to the correct fields..

---

_[View the full topic](https://discuss.elastic.co/t/how-can-i-generate-lat-long-fields-into-geo-point-in-elasticsearch/312329)._
