# Create geoip field in elasticsearch template

**URL:** <https://discuss.elastic.co/t/create-geoip-field-in-elasticsearch-template/167871>\
**Category:** Elasticsearch\
**Created:** [February 11, 2019, 2:49pm UTC](https://discuss.elastic.co/t/create-geoip-field-in-elasticsearch-template/167871 "2019-02-11T14:49:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [February 11, 2019, 2:49pm UTC](https://discuss.elastic.co/t/create-geoip-field-in-elasticsearch-template/167871/1 "2019-02-11T14:49:44Z")

</div>

I am using the `geoip` plugin of `logstash` to get geographical information about hosts.

I am using

```auto
          geoip {
            source => "dst"
          }

```

which seems to work, but creates the following two fields in my `elasticsearch` documents

![image](https://us1.discourse-cdn.com/elastic/original/3X/4/b/4b38bf8d9bec510b77879b6aaa42b532f35a3bbe.png)

How can I concatenate these in a `geoip` entry?

something like a composite json object in the likes of:

```auto
"geoip" : {
  "properties" : {
    "latitude" : { "type" : "half_float" },
    "longitude" : { "type" : "half_float" }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [February 15, 2019, 9:26pm UTC](https://discuss.elastic.co/t/create-geoip-field-in-elasticsearch-template/167871/2 "2019-02-15T21:26:48Z")

</div>

> How can I concatenate these in a `geoip` entry?

There is no `geoip` type in elasticsearch, I think it might be better to map location as a [`geo_point`](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/geo-point.html). You can do it like this:

```auto
"geoip": {
  "properties": {
    ... mapping for all other fields ...
    "location": {
      "type": "geo_point"
    }
  }
}
```

---

<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:** [March 15, 2019, 9:27pm UTC](https://discuss.elastic.co/t/create-geoip-field-in-elasticsearch-template/167871/3 "2019-03-15T21:27:19Z")

</div>

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