# 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:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Blason](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blason/32/42284_2.png) [@Blason](https://discuss.elastic.co/u/Blason)\
**Post date:** [September 6, 2017, 2:48am UTC](https://discuss.elastic.co/t/query-regarding-geoip/99210/21 "2017-09-06T02:48:20Z")

</div>

Well I am complete novice to Json hence not sure about making new one. By the way how about just renaming the existing one to the one with my index name?

---

<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:** [September 6, 2017, 5:30am UTC](https://discuss.elastic.co/t/query-regarding-geoip/99210/22 "2017-09-06T05:30:09Z")

</div>

You can't rename index templates but you can certainly get an existing one, edit it slightly, and post it to a new location.

---

<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 }
}
```

---

<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:** [October 16, 2017, 4:03am UTC](https://discuss.elastic.co/t/query-regarding-geoip/99210/24 "2017-10-16T04:03:29Z")

</div>

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

[Previous page](https://discuss.elastic.co/t/query-regarding-geoip/99210.md?page=1)
