# Problem with storing coordinates as geo\_point

**URL:** <https://discuss.elastic.co/t/problem-with-storing-coordinates-as-geo-point/71548>\
**Category:** Logstash\
**Created:** [January 13, 2017, 5:11pm UTC](https://discuss.elastic.co/t/problem-with-storing-coordinates-as-geo-point/71548 "2017-01-13T17:11:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oschlueter](https://avatars.discourse-cdn.com/v4/letter/o/ebca7d/32.png) [@oschlueter](https://discuss.elastic.co/u/oschlueter)\
**Post date:** [January 13, 2017, 5:11pm UTC](https://discuss.elastic.co/t/problem-with-storing-coordinates-as-geo-point/71548/1 "2017-01-13T17:11:37Z")

</div>

Hello everyone,

I'm facing an issue regarding storing coordinates as geo\_point. My goal is to add documents to ElasticSearch through a Logstash pipeline which I receive in JSON format. Omitting most of the fields the JSON looks like this:

```
{
    "text": "hello",
    "location": {
	"lat": "42.5064128",
	"lon": "1.52069438894224"
    }
}

```

Since I'm new to the ELK stack I've created a minimal, complete and verifiable example:

/etc/logstash/conf.d/mycompany-tweet-demo.conf:

```
input {
    tcp {
        port => 10000
        codec => "json"
    }
}

filter {	
    mutate {
        # this "works", however the location in no way matches the coordinates when displayed via tile map in Kibana
        #add_field => { "mylocation" => 52 }
        #add_field => { "mylocation" => 8 }

        # this yields "illegal latitude value [268.76953125] for mylocation"
        add_field => { "mylocation" => 51.9 }
        add_field => { "mylocation" => 7.9 }

        # this yields "illegal latitude value [269.1322946548462] for mylocation" for the demo JSON
        #add_field => { "mylocation" => "%{[location][lat]}" }
        #add_field => { "mylocation" => "%{[location][lon]}" }
    }
}

output {
    elasticsearch {
        hosts => "http://localhost:9200"
        index => "mycompany-tweet-demo"
        document_type => "tweet"

        template => "/etc/logstash/templates/mycompany-demo-template.json"
        template_overwrite => true
    }
}

```

/etc/logstash/templates/mycompany-demo-template.json:

```
{
    "template": "mycompany-*",
    "mappings": {
        "_default_": {
            "properties": {
                "mylocation" : {
                    "type" : "geo_point"
                }
            }
        }
    }
}

```

~/one.json:

```
{"text":"hello","location":{"lat":"42.5064128","lon":"1.52069438894224"}}

```

cat ~/one.json | nc localhost 10000

```
[2017-01-13T17:41:38,504][WARN][logstash.outputs.elasticsearch] Failed action. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"mycompany-tweet-demo", :_type=>"tweet", :_routing=>nil}, 2017-01-13T16:41:38.458Z 0:0:0:0:0:0:0:1 %{message}], :response=>{"index"=>{"_index"=>"mycompany-tweet-demo", "_type"=>"tweet", "_id"=>"AVmYtLvEovM5deO5CNpA", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"illegal latitude value [269.1322946548462] for mylocation"}}}}}

```

Based on the documentation of [geo\_point](http://doodle.com/poll/95mnb449we8z4dsw) and some posts on stackoverflow I've read, I'd expect my example with values between 0 and 90 to work. Could anyone point out what I'm doing wrong?

---

<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:** [February 10, 2017, 5:11pm UTC](https://discuss.elastic.co/t/problem-with-storing-coordinates-as-geo-point/71548/2 "2017-02-10T17:11:59Z")

</div>

Closed on February 10, 2017, 5:11pm UTC

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