# GeoIP Pipeline and Geopoint

**URL:** <https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127>\
**Category:** Elasticsearch\
**Created:** [January 29, 2017, 1:01pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127 "2017-01-29T13:01:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Bullock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_bullock/32/47550_2.png) [@Matthew\_Bullock](https://discuss.elastic.co/u/Matthew_Bullock)\
**Post date:** [January 29, 2017, 1:01pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/1 "2017-01-29T13:01:30Z")

</div>

Hi I have a pipeline that remaps an IP address to location points using GeoIP. When I import data via the bulk API and pass it through the pipeline I can see the added fields in Kibana.

![](https://us1.discourse-cdn.com/elastic/original/2X/7/7b4d74a14a7e14f52b1d0d909a549f658d9b6dc7.png)

The issue is Lon and Lat are separate fields and not set as GeoPoint and therefore I cannot map these? - The index mapping is automatic and has put them as a number.

I am an ELK stack n00b so any help would be much appreciated. I am just running a local instance on my Mac and installed via brew.

Question - 2 is there anything I can add to an index mapping that imports the rest of the data if a field is missing. I.e I have a field with a date that only exists 50% of the time however if that field is missing then when indexing it errors and does not import.

Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 29, 2017, 1:40pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/2 "2017-01-29T13:40:22Z")

</div>

You need to define the mapping first.

---

<div class="post-metadata">

**Author:** ![Matthew\_Bullock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_bullock/32/47550_2.png) [@Matthew\_Bullock](https://discuss.elastic.co/u/Matthew_Bullock)\
**Post date:** [January 29, 2017, 1:57pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/3 "2017-01-29T13:57:25Z")

</div>

When I tried adding an index mapping due to the data not being in the JSON as it is added by the pipeline it errors.

Do I map each Lon and Lat field individually as a Geo point?

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 29, 2017, 3:25pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/4 "2017-01-29T15:25:43Z")

</div>

No. The location field must be a geopoint.

---

<div class="post-metadata">

**Author:** ![Matthew\_Bullock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_bullock/32/47550_2.png) [@Matthew\_Bullock](https://discuss.elastic.co/u/Matthew_Bullock)\
**Post date:** [January 29, 2017, 3:39pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/5 "2017-01-29T15:39:33Z")

</div>

I tried a simple mapping:

```
PUT /waf/_mapping/location?pretty
{
      "properties": {
        "location": {
          "type": "geo_point"
        }
      }
    }

```

I run the import and get

```
{"index":{"_index":"waf","_type":"logs","_id":"3215102fa4eb0c9b","status":400,"error":{"type":"illegal_argument_exception","reason":"[geoip.location] is defined as an object in mapping [logs] but this name is already used for a field in other types"}}}]

```

I am sure I am missing something simple.

Thanks again!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 29, 2017, 8:26pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/6 "2017-01-29T20:26:10Z")

</div>

You probably indexed already documents or have a mapping.  
You need to start from scratch as you can't change the existing mapping .

---

<div class="post-metadata">

**Author:** ![Matthew\_Bullock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_bullock/32/47550_2.png) [@Matthew\_Bullock](https://discuss.elastic.co/u/Matthew_Bullock)\
**Post date:** [January 29, 2017, 8:42pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/7 "2017-01-29T20:42:58Z")

</div>

comment - deleted

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 29, 2017, 9:10pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/8 "2017-01-29T21:10:06Z")

</div>

Run GET yourindexname/\_mapping to see what your mapping is.

---

<div class="post-metadata">

**Author:** ![Matthew\_Bullock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_bullock/32/47550_2.png) [@Matthew\_Bullock](https://discuss.elastic.co/u/Matthew_Bullock)\
**Post date:** [January 29, 2017, 9:35pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/9 "2017-01-29T21:35:48Z")

</div>

Sorry David you were correct this was in my mapping. However I am struggling to map lon and lat to string and the location to a geo\_point it keeps treating them as separate and not the correct method for a geo point. The closest I got was lat and lon were string but also managed to create a new field called geopoing.location.loacation which saved as a geo point but stored no data as there was not matches

```
      },
  "geoip": {
    "properties": {
      "location": {
        "properties": {
          "lat": {
            "type": "float"
          },
          "lon": {
            "type": "float"
          }
        }
      }
    }
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 29, 2017, 9:52pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/10 "2017-01-29T21:52:24Z")

</div>

Hard to tell without knowing what you are exactly doing.

Could you share a script which reproduce what you are doing?

---

<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:** [February 26, 2017, 9:52pm UTC](https://discuss.elastic.co/t/geoip-pipeline-and-geopoint/73127/11 "2017-02-26T21:52:27Z")

</div>

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