# How to construct geo\_point field from separate fields of latitude and longitude for Kibana 5.4?

**URL:** https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755
**Category:** Logstash
**Created:** [July 4, 2017, 11:31am UTC](https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755 "2017-07-04T11:31:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![monai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/monai/32/19744_2.png) [@monai](https://discuss.elastic.co/u/monai)
#### Post date: [July 4, 2017, 11:31am UTC](https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755/1 "2017-07-04T11:31:24Z")

</div>

From input data I have 2 fields of location - latitude and longitude.  
How can I construct a geo\_point location field to create map visualization in logstash config (version 5.4)?

Thank you.

Updated - Summarize of the steps need to construct geo\_point:

1. Create an index at Elasticsearch  
`PUT my_index`

2. Create a geo\_point mapping type at the new created index

3. Configure Logstash to map latitude and longitude to our created geo\_point type

4. Run Logstash to load the data into Elasticsearch

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [July 4, 2017, 11:35am UTC](https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755/2 "2017-07-04T11:35:25Z")

</div>

You need to merge the values from those two fields into a single field. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html) for the different kinds of field values that ES supports for geo\_point fields.

Secondly, modify the mapping of the index so that the field is mapped as geo\_point. This is typically done via an index template.

---

<div class="post-metadata">

### Author: ![monai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/monai/32/19744_2.png) [@monai](https://discuss.elastic.co/u/monai)
#### Post date: [July 4, 2017, 11:54am UTC](https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755/3 "2017-07-04T11:54:19Z")

</div>

As refer to the documentation you provided, I configured Logstash to add those 2 fields into location structure like this:

```
mutate {
    convert => { "longitude" => "float" }
    convert => { "latitude" => "float" }
}
mutate {
    rename => {
        "longitude" => "[location][lon]"
        "latitude" => "[location][lat]"
    }
}

```

Do I still need to manually mapping the index at Elasticsearch again by adding location field like this?

```
"mappings": {
	"logs": {
		"properties": {
			"eventid": {
				"type": "long"
			},
			"createdon": {
				"type": "date"
			},
			......
			"id": {
				"type": "long"
			},
            "location": {
                "type": "geo_point"
            }
		}
	}
}

```

Now the field location has created but there is no data appear in this field yet. Which method should I use to make the data appeared in this new field?

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [July 4, 2017, 12:44pm UTC](https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755/4 "2017-07-04T12:44:08Z")

</div>

> Do I still need to manually mapping the index at Elasticsearch again by adding location field like this?

Yes.

> Now the field location has created but there is no data appear in this field yet. Which method should I use to make the data appeared in this new field?

Let Logstash process your data (again).

---

<div class="post-metadata">

### Author: ![monai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/monai/32/19744_2.png) [@monai](https://discuss.elastic.co/u/monai)
#### Post date: [July 5, 2017, 12:59am UTC](https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755/5 "2017-07-05T00:59:40Z")

</div>

Now it works, thank you!

Summarize of the steps need to construct geo\_point:

1. Create an index at Elasticsearch  
`PUT my_index`

2. Create a geo\_point mapping type at the new created index

3. Configure Logstash to map latitude and longitude to our created geo\_point type

4. Run Logstash to load the data into Elasticsearch

---

<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: [August 2, 2017, 1:00am UTC](https://discuss.elastic.co/t/how-to-construct-geo-point-field-from-separate-fields-of-latitude-and-longitude-for-kibana-5-4/91755/6 "2017-08-02T01:00:11Z")

</div>

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