# How can I convert to geo\_point a field extracted with translate filter?

**URL:** https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141
**Category:** Logstash
**Created:** [November 20, 2015, 10:10am UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141 "2015-11-20T10:10:00Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![adellarocca](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@adellarocca](https://discuss.elastic.co/u/adellarocca)
#### Post date: [November 20, 2015, 10:10am UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/1 "2015-11-20T10:10:00Z")

</div>

Hi!  
I have extracted geo information with translate filter using a dictionary file YAML as follow  
location1: 42.1497, -74.9384  
location2: 34.5677, -32.8393  
.........................................  
The logstash conf file translate section is

```
translate{
		field => "ORIGIN_STATE_ABR"
		destination => "ORIGIN_LOCATION"
		dictionary_path => "/home/alessandro/Scrivania/dataset/us_dictionary.yaml"
	}

mutate {
		
		convert => {

			"ORIGIN_LOCATION" => "string"					

		}			

		convert => { 
			"DEP_DELAY" => "float"
			"ARR_DELAY" => "float"
			"AIR_TIME" => "float"
			"ORIGIN_LOCATION" => "geo_point"
		}
}

```

When I execute Logstash I have follow error

**"Error: Cannot register filter mutate plugin. The error reported is:**  
**Invalid conversion type '["string", "geo\_point"]', expected one of 'string,integer,float,boolean'"**

What's the problem?

Thank you at all!

---

<div class="post-metadata">

### Author: ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)
#### Post date: [November 20, 2015, 11:42am UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/2 "2015-11-20T11:42:23Z")

</div>

Hi, you'd better ask this question in the [Logstash forum](https://discuss.elastic.co/c/logstash).

---

<div class="post-metadata">

### Author: ![adellarocca](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@adellarocca](https://discuss.elastic.co/u/adellarocca)
#### Post date: [November 20, 2015, 11:48am UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/3 "2015-11-20T11:48:32Z")

</div>

Sorry! I'm confused.  
Thank you very much

---

<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: [November 20, 2015, 2:30pm UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/4 "2015-11-20T14:30:59Z")

</div>

> "Error: Cannot register filter mutate plugin. The error reported is:  
> Invalid conversion type '["string", "geo\_point"]', expected one of 'string,integer,float,boolean'"

Logstash emits JSON documents and those don't have geo\_point types. See [Geo Point Type | Elasticsearch Guide [1.7] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/mapping-geo-point-type.html#_input_structure) for a list of what kind of input Elasticsearch accepts to fields mapped as geo\_point.

---

<div class="post-metadata">

### Author: ![adellarocca](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@adellarocca](https://discuss.elastic.co/u/adellarocca)
#### Post date: [November 20, 2015, 3:46pm UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/5 "2015-11-20T15:46:38Z")

</div>

Thank you for your support magnusbaeck!  
I've read your link and I've follow your suggest.  
Now, my mapping is

```
"origin_location": {
        "properties": {
          "location": {
            "type" : "geo_point"
          }
        }
      }

```

And my logstash.conf section for this field is

```
translate{
		field => "origin_state_abr"
		destination => "temp_origin_location"
		dictionary_path => "/home/alessandro/Scrivania/dataset/us_dictionary.yaml"
	}

	mutate {
			
		add_field => { "[origin_location][location]"=> "%{tempo_origin_location}"} 
			
		convert => { 
				"DEP_DELAY" => "float"
				"ARR_DELAY" => "float"
				"AIR_TIME" => "float"
			}
	}

```

But when i run logstash I have this error

**"status"=\>400, "error"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"Mapper for [origin\_location] conflicts with existing mapping in other types[mapper [origin\_location.location] of different type, current\_type [geo\_point], merged\_type [string]]"}}}, :level=\>:warn}**

Where's the problem!

Thank you for your support!  
I haven't words to thank you.

---

<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: [November 20, 2015, 8:36pm UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/6 "2015-11-20T20:36:30Z")

</div>

You have two different mappings for `origin_location.location` in the same index. It was previously a string but now you're trying to make it a geo\_point. You need to reindex.

---

<div class="post-metadata">

### Author: ![adellarocca](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@adellarocca](https://discuss.elastic.co/u/adellarocca)
#### Post date: [November 23, 2015, 7:51am UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/7 "2015-11-23T07:51:31Z")

</div>

Thank you magnusbaeck.  
The step that I followed are:

1. I have defined index "air-data-index" with the mapping, where I have specified "geo\_point" type
2. I've used logstash with the file conf.

I've understood the error but how can I re-index?  
Must I create a new index and a new mapping?  
Thank you!

---

<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: [November 23, 2015, 1:42pm UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/8 "2015-11-23T13:42:38Z")

</div>

Create a new index with correct mappings, bulk-copy documents from the old to the new index, and delete the original index. If you want the new index to be usable with the same name as the old one you can add an alias.

Reindexing has been covered here before. Please search the archives.

---

<div class="post-metadata">

### Author: ![adellarocca](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@adellarocca](https://discuss.elastic.co/u/adellarocca)
#### Post date: [November 24, 2015, 1:19pm UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/9 "2015-11-24T13:19:43Z")

</div>

Thank you for your support magnusbaeck.  
I'm very grateful 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: [July 6, 2017, 5:21am UTC](https://discuss.elastic.co/t/how-can-i-convert-to-geo-point-a-field-extracted-with-translate-filter/35141/10 "2017-07-06T05:21:31Z")

</div>


