# Geoip

**URL:** https://discuss.elastic.co/t/geoip/57235
**Category:** Kibana
**Created:** [August 4, 2016, 2:53pm UTC](https://discuss.elastic.co/t/geoip/57235 "2016-08-04T14:53:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![kharbechtein](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@kharbechtein](https://discuss.elastic.co/u/kharbechtein)
#### Post date: [August 4, 2016, 2:53pm UTC](https://discuss.elastic.co/t/geoip/57235/1 "2016-08-04T14:53:35Z")

</div>

Hello ,

I am new to the Elastic Stack and I have no idea how to map my geoip data. I've tried the following mapping:

curl -H "kbn-version: 4.5.2" -XPUT [http://localhost:9200/geo\_ip](http://localhost:9200/geo_ip) -d'  
{  
"mappings" : {  
"_default_" : {  
"properties" : {  
"email":{"type":"string","index":"not\_analyzed"},  
"age":{"type":"integer","index":"not\_analyzed"},  
"ca":{"type":"double"},  
"geoip":{"type":"ip"}

}  
}  
}  
}  
';

and this a sample from the json file :

{ "index" : { "\_index" : "geo\_ip", "\_type" : "gelocalisation", "\_id" : "1" } }  
{ "id": 1, "email": "a1@gmail.com","age": 15,"ca": 850,"ip":"88.190.229.170"}

I really do not know how making Geoip work fine and locate users via their IP addresses.

Thanks in advance.

---

<div class="post-metadata">

### Author: ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)
#### Post date: [August 4, 2016, 8:03pm UTC](https://discuss.elastic.co/t/geoip/57235/2 "2016-08-04T20:03:34Z")

</div>

Your mapping and data looks fine to me, except for one typo: in your mapping query, you specify "geo\_ip" as the index name, but in your data, the index name has no underscore: "geoip". So that's probably a minor issue.

Another minor issue is that in your JSON, you need to define the "\_index", "\_type", and "\_id" properties with underscores: "{ "index" : { "\_index" : "geoip", "\_type" : "gelocalisation", "\_id" : "1" } }". (To see what I mean, see the sample data in the Getting Started docs: [https://www.elastic.co/guide/en/kibana/current/getting-started.html](https://www.elastic.co/guide/en/kibana/current/getting-started.html)).

But these are little issues. I think the more underlying problem is that you need to use the Logstash GeoIP filter to extract geolocation information from the IP. Kibana can't do this on its own. Take a look at this StackOverflow issue that outlines the process and please let me know if it helps you: [http://stackoverflow.com/questions/33522175/convert-existing-field-mapping-to-geoip](http://stackoverflow.com/questions/33522175/convert-existing-field-mapping-to-geoip)

Here's more information on the Logstash GeoIP filter: [https://www.elastic.co/guide/en/logstash/current/plugins-filters-geoip.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-geoip.html)

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 5, 2016, 12:08am UTC](https://discuss.elastic.co/t/geoip/57235/3 "2016-08-05T00:08:45Z")

</div>

> [@kharbechtein](#):
>
> "geoip":{"type":"ip"}

That's mapping an IP type, not a `geo_point` type, you don't have the latter at all so you will never be able to map anything.

Also, you should use something like Logstash with the [geoip filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-geoip.html) to convert the IP into coordinates.

---

<div class="post-metadata">

### Author: ![kharbechtein](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@kharbechtein](https://discuss.elastic.co/u/kharbechtein)
#### Post date: [August 5, 2016, 10:06am UTC](https://discuss.elastic.co/t/geoip/57235/4 "2016-08-05T10:06:46Z")

</div>

Hello,  
First of all I would like to thank you for your detailed response and your time.

Yet, I made a new mapping following the solution provided with in your stackoverflow link, but no result was found. Should I have the configuration file in Logstash executed for every new index?

Thanks again.

---

<div class="post-metadata">

### Author: ![kharbechtein](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@kharbechtein](https://discuss.elastic.co/u/kharbechtein)
#### Post date: [August 5, 2016, 10:07am UTC](https://discuss.elastic.co/t/geoip/57235/5 "2016-08-05T10:07:32Z")

</div>

Thanks for your repsonse.  
I will read more about that.

Thanks.

---

<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 6, 2017, 1:41pm UTC](https://discuss.elastic.co/t/geoip/57235/6 "2017-07-06T13:41:56Z")

</div>


