# Unable to use geo\_point

**URL:** <https://discuss.elastic.co/t/unable-to-use-geo-point/153442>\
**Category:** Kibana\
**Created:** [October 22, 2018, 3:47pm UTC](https://discuss.elastic.co/t/unable-to-use-geo-point/153442 "2018-10-22T15:47:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcvl](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rcvl](https://discuss.elastic.co/u/rcvl)\
**Post date:** [October 22, 2018, 3:47pm UTC](https://discuss.elastic.co/t/unable-to-use-geo-point/153442/1 "2018-10-22T15:47:14Z")

</div>

Hi everybody,

I try to parse my JSON in the `logstash.conf` to retrieve GPS coordinates and do data viewing with Coordinate Map.

Here is my `logstash.conf` :

```auto

input {
  kafka {
    bootstrap_servers => "localhost:9092"
    topics => ["villorep"]
  }
}

filter {
  json {
    source => "[message]"
    target => "doc"
    add_field => ["available_bikes", "%{[doc][fields][available_bikes]}" ]
    add_field => ["available_bike_stands", "%{[doc][fields][available_bike_stands]}" ]
    add_field => ["bike_stands", "%{[doc][fields][bike_stands]}" ]
    add_field => ["name", "%{[doc][fields][name]}" ]
    add_field => ["address", "%{[doc][fields][address]}" ]
    add_field => ["[geoip][location]", "%{[doc][fields][position][0]}"]
    add_field => ["[geoip][location]", "%{[doc][fields][position][1]}"]
  }

  mutate {
    convert => { "available_bikes" => "integer" }
    convert => { "available_bike_stands" => "integer" }
    convert => { "bike_stands" => "integer" }
    remove_field => "fields"
    remove_field => "doc"
    remove_field => "message"
    convert => { "[geoip][location]" => "float" }
  }
}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "villorep"
    workers => 1
  }
}

```

Here is my mapping :

```auto
{
  "villorep": {
    "aliases": {},
    "mappings": {
      "doc": {
        "properties": {
          "@timestamp": {
            "type": "date"
          },
          "@version": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "address": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "available_bike_stands": {
            "type": "long"
          },
          "available_bikes": {
            "type": "long"
          },
          "bike_stands": {
            "type": "long"
          },
          "geoip": {
            "properties": {
              "location": {
                "type": "float"
              }
            }
          },
          "name": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      }
    },
    "settings": {
      "index": {
        "creation_date": "1540222008168",
        "number_of_shards": "5",
        "number_of_replicas": "1",
        "uuid": "7RJvlyisSb2kUivf9vpkgw",
        "version": {
          "created": "6040299"
        },
        "provided_name": "villorep"
      }
    }
  }
} 

```

The log is the following :

 ![Capture%20du%202018-10-22%2017-41-31](https://us1.discourse-cdn.com/elastic/original/3X/3/3/335411d0b08747d4aa4adfebfe9c16692b5b198e.png)

How should I map my location with de geo\_point type ? What is going wrong in my configuration file ?Thank you in advance for paying attention to my issue.

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [October 22, 2018, 9:04pm UTC](https://discuss.elastic.co/t/unable-to-use-geo-point/153442/2 "2018-10-22T21:04:59Z")

</div>

You'll need to use an index template to tell Elasticsearch that the `villorep` index has a `geoip` field that is a geo point. You can see how the default index template created by the Elasticsearch output for Logstash does that here: [https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/master/lib/logstash/outputs/elasticsearch/elasticsearch-template-es7x.json#L34](https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/master/lib/logstash/outputs/elasticsearch/elasticsearch-template-es7x.json#L34)

---

<div class="post-metadata">

**Author:** ![rcvl](https://avatars.discourse-cdn.com/v4/letter/r/9fc29f/32.png) [@rcvl](https://discuss.elastic.co/u/rcvl)\
**Post date:** [October 25, 2018, 9:08am UTC](https://discuss.elastic.co/t/unable-to-use-geo-point/153442/3 "2018-10-25T09:08:19Z")

</div>

Finally got it ! Thank you for your help. Please find my solution below. 😀

`logstash.conf` :

> filter {  
> json {  
> source =\> "[message]"  
> target =\> "doc"  
> add\_field =\> ["available\_bikes", "%{[doc][fields][available\_bikes]}" ]  
> add\_field =\> ["available\_bike\_stands", "%{[doc][fields][available\_bike\_stands]}" ]  
> add\_field =\> ["bike\_stands", "%{[doc][fields][bike\_stands]}" ]  
> add\_field =\> ["name", "%{[doc][fields][name]}" ]  
> add\_field =\> ["address", "%{[doc][fields][address]}" ]  
> add\_field =\> ["[location]", "%{[doc][fields][position][1]}"]  
> add\_field =\> ["[location]", "%{[doc][fields][position][0]}"]  
> }

```
mutate {
  convert => { "available_bikes" => "integer" }
  convert => { "available_bike_stands" => "integer" }
  convert => { "bike_stands" => "integer" }
  remove_field => "fields"
  remove_field => "doc"
  remove_field => "message"
  convert => { "[geoip][location]" => "float" }
}

```

I switched [lat, lng] for [lng, lat] as the template shows.

Then I modified my mapping as :

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

```

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [October 25, 2018, 2:42pm UTC](https://discuss.elastic.co/t/unable-to-use-geo-point/153442/4 "2018-10-25T14:42:27Z")

</div>

Glad to hear!

---

<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:** [November 22, 2018, 2:42pm UTC](https://discuss.elastic.co/t/unable-to-use-geo-point/153442/5 "2018-11-22T14:42:28Z")

</div>

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