# Query regarding GeoIP

**URL:** <https://discuss.elastic.co/t/query-regarding-geoip/99210>\
**Category:** Logstash\
**Created:** [September 3, 2017, 6:46am UTC](https://discuss.elastic.co/t/query-regarding-geoip/99210 "2017-09-03T06:46:38Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![mlrus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mlrus/32/22181_2.png) [@mlrus](https://discuss.elastic.co/u/mlrus)\
**Post date:** [September 18, 2017, 4:03am UTC](https://discuss.elastic.co/t/query-regarding-geoip/99210/23 "2017-09-18T04:03:17Z")

</div>

Managed templates offer a simple reliable solution, based on the conclusion of **[removing the settings section](https://discuss.elastic.co/t/cannot-get-my-template-to-work/27150)**. The template\_file is referenced by the logstash configuration invoked with `logstash.bat -f plain.conf`.

Template file (`plain_template.json`)

```
{"template":"plain*","order":0,"version":50001,"mappings":{"_default_":{"properties":{"placename":{"type":"text"},"x":{"type":"float"},"y":{"type":"float"},"latitude":{"type":"half_float"},"longitude":{"type":"half_float"},"location":{"type":"geo_point"}}}},"aliases":{}}

```

Logstash configuration (`plain.conf`)

```
input {
    file {
        path => "$(pwd -W)/plain.json"
        codec => json
        start_position => "beginning"
    }
}

filter {
    mutate {
        add_field => {
          "location[lat]" => "%{y}"
          "location[lon]" => "%{x}"
        }
        convert => {
          "location[lat]" => "float"
          "location[lon]" => "float"
        }
    }
}

output {
    elasticsearch {
        template => "$(pwd -W)/plain_template.json"
        template_name => "plain_template"
        hosts => ["localhost:9200"]
        index => "plain-%{+YYYY.MM.dd}"
    }
    stdout { codec => rubydebug }
}
```

---

_[View the full topic](https://discuss.elastic.co/t/query-regarding-geoip/99210)._
