# Understanding ElasticSearch Pipeline Geopoint

**URL:** <https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325>\
**Category:** Siren Platform/Investigate Tech Support Community\
**Created:** [October 21, 2020, 3:03am UTC](https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325 "2020-10-21T03:03:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffd](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jeffd](https://community.siren.io/u/jeffd)\
**Post date:** [October 21, 2020, 3:03am UTC](https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325/1 "2020-10-21T03:03:01Z")

</div>

I used the following code to combine two columns into a geopoint however the end result is type unknown. When I go to investigate the columns some of the fields are “” empty and/or null. What is the expect behavior of this code when a lat and/or lon is null (null or “'”)?  
Also, when I run the transform/ingest how does siren know to make this type geo\_point?

> ```
> {
> "description": "Create geo point field",
> "processors": [
> {
> "set": {
> "field": "geo_location",
> "value": {
> "lat": "{{latitude_field}}",
> "lon": "{{longitude_field}}"
> }
> }
> }
> ]
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![Manu\_Agarwal](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.siren.io/manu_agarwal/32/120_2.png) [@Manu\_Agarwal](https://community.siren.io/u/Manu_Agarwal)\
**Post date:** [October 21, 2020, 10:29am UTC](https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325/2 "2020-10-21T10:29:42Z")

</div>

Hi Jeff,

If the mapping does not already exists and the first instance of ‘geo\_location’ field that Elasticsearch encounters is a valid lat and lon, then ES will auto-map the field to geo\_point. To ensure that in a spreadsheet with missing column values, skip setting ‘geo\_location’ field where the columns have invalid data:

```auto
{
 "description": "Create geo point field, skipping null column values.",
 "processors": [
   {
     "set": {
       "if": "ctx.latitude_field != null && ctx.longitude_field != null",
       "field": "geo_location",
       "value": {
           "lat": "{{latitude_field}}",
           "lon": "{{longitude_field}}"
       }
     }
   }
 ]
}

```

This will skip the processor in case the value is not set, please keep this is mind: null is not equal to string literal ‘null’ which can be set in certain spreadsheets. The if condition can be modified as desired.

Regards  
Manu

---

<div class="post-metadata">

**Author:** ![jeffd](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jeffd](https://community.siren.io/u/jeffd)\
**Post date:** [October 21, 2020, 10:17pm UTC](https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325/3 "2020-10-21T22:17:25Z")

</div>

Update. I tried the method above. It still left the geo\_location Field of unknown Type. I tried it with setting the mapping first. That seemed to work but I had to refresh the fields on the data source. Not as intuitive as I’d like. It works now.

---

<div class="post-metadata">

**Author:** ![JefersonZanim](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.siren.io/jefersonzanim/32/169_2.png) [@JefersonZanim](https://community.siren.io/u/JefersonZanim)\
**Post date:** [October 22, 2020, 10:17am UTC](https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325/4 "2020-10-22T10:17:57Z")

</div>

Hi Jeff,

If you set the field type to be geo\_point in the mappings before you insert the data, it should work. In the following link, the very first PUT command specifies the mapping for it, as an example.

> **[Geo-point field type | Elasticsearch Reference \[7.9\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html)**

Regards,  
Jeferson

---

<div class="post-metadata">

**Author:** ![jeffd](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jeffd](https://community.siren.io/u/jeffd)\
**Post date:** [October 27, 2020, 12:48am UTC](https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325/5 "2020-10-27T00:48:20Z")

</div>

Hi Jeferson, Thanks for the response. Can the mapping be added during time of of ingest in an ingest pipeline? If I add it after the ingest pipeline I get errors (i.e., already exists).

---

<div class="post-metadata">

**Author:** ![JefersonZanim](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.siren.io/jefersonzanim/32/169_2.png) [@JefersonZanim](https://community.siren.io/u/JefersonZanim)\
**Post date:** [January 5, 2021, 10:06am UTC](https://community.siren.io/t/understanding-elasticsearch-pipeline-geopoint/325/6 "2021-01-05T10:06:59Z")

</div>

Hi Jeff,

The mappings are usually applied before the ingestion, as it defines the type of the field.

Regards,  
Jeferson
