# Geoip.location.lat and geoip.location.lon showing as number, cannot convert to geoip type

**URL:** https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475
**Category:** Logstash
**Created:** [May 20, 2020, 7:01am UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475 "2020-05-20T07:01:56Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![mostafa\_kamal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mostafa_kamal/32/50914_2.png) [@mostafa\_kamal](https://discuss.elastic.co/u/mostafa_kamal)
#### Post date: [May 20, 2020, 7:01am UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/1 "2020-05-20T07:01:56Z")

</div>

I actually want to make a user-location based map in kibana, but I cannot do that because geoip.location.lat and geoip.location.lon showing as number, I cannot convert to geoip type.

this is my logstash conf

```auto
filter {
        if "abc" in [tags] {
				grok {
						match => { "message" => '\A%{IPORHOST:clientip} %{HTTPDUSER:remote_logical_user} %{HTTPDUSER:authenticated_user} \[%{HTTPDATE:timestamp}\] "%{WORD:method} %{NOTSPACE:request} (?<http_version>[a-zA-Z\/\d\.]+)" %{NUMBER:response_code} (?:%{NUMBER:bytes_sent}|-)' }
				}

				date {
						match => ["timestamp" , "dd/MMM/yyyy:HH:mm:ss Z"]
				}
				
				geoip {
						source => "clientip"
				}
        }

}

```

my filter is doing good and I can discover following fields related to geoip

geoip.continent\_code  
geoip.country\_code2  
geoip.country\_code3  
geoip.country\_name  
geoip.ip  
geoip.latitude  
geoip.location.lat  
geoip.location.lon  
geoip.longitude  
geoip.timezone

---

<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: [May 20, 2020, 7:08am UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/2 "2020-05-20T07:08:09Z")

</div>

Did you rename your output index?

---

<div class="post-metadata">

### Author: ![mostafa\_kamal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mostafa_kamal/32/50914_2.png) [@mostafa\_kamal](https://discuss.elastic.co/u/mostafa_kamal)
#### Post date: [May 20, 2020, 7:09am UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/3 "2020-05-20T07:09:23Z")

</div>

no, I am sending the index name by filebeat. No changes made in logstash.

---

<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: [May 20, 2020, 7:10am UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/4 "2020-05-20T07:10:30Z")

</div>

Are you sending Filebeat \> Logstash? And then sending to Elasticsearch with no changes to the defaults?

---

<div class="post-metadata">

### Author: ![mostafa\_kamal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mostafa_kamal/32/50914_2.png) [@mostafa\_kamal](https://discuss.elastic.co/u/mostafa_kamal)
#### Post date: [May 20, 2020, 7:12am UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/5 "2020-05-20T07:12:08Z")

</div>

yes

this is my filebeat conf

```auto
- type: log
  enabled: true
  paths:
    - /abc/localhost_access_log.*.txt
  fields_under_root: true
  fields:
    index: ["logstash-abc"]
  tags: ["abc"]

```

---

<div class="post-metadata">

### Author: ![mostafa\_kamal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mostafa_kamal/32/50914_2.png) [@mostafa\_kamal](https://discuss.elastic.co/u/mostafa_kamal)
#### Post date: [May 20, 2020, 7:37am UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/6 "2020-05-20T07:37:01Z")

</div>

can anyone help?

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 20, 2020, 4:08pm UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/7 "2020-05-20T16:08:07Z")

</div>

What is your index name?

---

<div class="post-metadata">

### Author: ![Feedy](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@Feedy](https://discuss.elastic.co/u/Feedy)
#### Post date: [May 20, 2020, 5:11pm UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/8 "2020-05-20T17:11:39Z")

</div>

@mostafa_kamal - you may need to include the add\_field option. See below:

```auto
filter {
        if "abc" in [tags] {
				grok {
						match => { "message" => '\A%{IPORHOST:clientip} %{HTTPDUSER:remote_logical_user} %{HTTPDUSER:authenticated_user} \[%{HTTPDATE:timestamp}\] "%{WORD:method} %{NOTSPACE:request} (?<http_version>[a-zA-Z\/\d\.]+)" %{NUMBER:response_code} (?:%{NUMBER:bytes_sent}|-)' }
				}

				date {
						match => ["timestamp" , "dd/MMM/yyyy:HH:mm:ss Z"]
				}
				
				geoip {
						source => "clientip"
                                                add_field => {
                                     "[geoip][enteryourfieldname]" => "%{[geoip][latitude]},%{[geoip][longitude]}"
                                                }
			         }
        }

}

```

The add\_field option will create a new field and combine the latitude and longitude values to the new field.

---

<div class="post-metadata">

### Author: ![mostafa\_kamal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mostafa_kamal/32/50914_2.png) [@mostafa\_kamal](https://discuss.elastic.co/u/mostafa_kamal)
#### Post date: [May 22, 2020, 3:21pm UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/9 "2020-05-22T15:21:51Z")

</div>

@Feedy, I have added add\_field option. But that also shows like a string.

```auto
				geoip {
						source => "clientip"
                                add_field => {
										"[geoip][geoip_custom_location]" => "%{[geoip][latitude]},%{[geoip][longitude]}"
                                             }
			         }

```

How to create map with that?

---

<div class="post-metadata">

### Author: ![Feedy](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@Feedy](https://discuss.elastic.co/u/Feedy)
#### Post date: [May 22, 2020, 4:50pm UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/10 "2020-05-22T16:50:12Z")

</div>

@mostafa_kamal  
Please show your field mapping for this index. You may need to update this index mapping to reflect the new field. Here is a screenshot of the field mapping for my index(where you see "coordinates" is the same as your "geoip\_custom\_location" I just choose to use a different name):

 ![index_mapping_geoip](https://us1.discourse-cdn.com/elastic/original/3X/2/f/2faff563839616c7f98535065a31ad825b329df2.jpeg)

---

<div class="post-metadata">

### Author: ![mostafa\_kamal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mostafa_kamal/32/50914_2.png) [@mostafa\_kamal](https://discuss.elastic.co/u/mostafa_kamal)
#### Post date: [May 22, 2020, 6:22pm UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/11 "2020-05-22T18:22:10Z")

</div>

@Feedy, thanks for your feedback.  
Actually, I did kinda the same thing.

I have created a template and convert the field to geo\_point. I have created a new index and it's solved now.

```auto
PUT _template/abc
{
"index_patterns": [
  "abc"
  ],
"settings": { },
 "mappings": {
   "properties": {
     "def" : {
       "type": "geo_point"
        }
      }
    }, 
"aliases": { }
}

```

Thank you.

---

<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: [June 19, 2020, 6:22pm UTC](https://discuss.elastic.co/t/geoip-location-lat-and-geoip-location-lon-showing-as-number-cannot-convert-to-geoip-type/233475/12 "2020-06-19T18:22:13Z")

</div>

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