# Creating Custom elasticsearch templates

**URL:** <https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483>\
**Category:** Elasticsearch\
**Created:** [November 9, 2016, 1:01pm UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483 "2016-11-09T13:01:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![setlem](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@setlem](https://discuss.elastic.co/u/setlem)\
**Post date:** [November 9, 2016, 1:01pm UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483/1 "2016-11-09T13:01:47Z")

</div>

Hi all,  
i am trying to create custom elasticsearch template.  
after i create a template and update it in .conf am not getting any output.  
My template is:

> [@](#):
>
> curl -XPUT [http://localhost:9200/\_template/logstash\_indexPattern\_line](http://localhost:9200/_template/logstash_indexPattern_line) -d '
> 
> {  
> "logstash": {  
> "order": 0,  
> "template": "data-_",  
> "settings": {  
> "index": {  
> "refresh\_interval": "5s"  
> }  
> },  
> "mappings": {  
> "default": {  
> "dynamic\_templates": [  
> {  
> "message\_field": {  
> "mapping": {  
> "fielddata": {  
> "format": "disabled"  
> },  
> "index": "not\_analyzed",  
> "omit\_norms": true,  
> "type": "string"  
> },  
> "match\_mapping\_type": "string",  
> "match": "message"  
> }  
> },  
> {  
> "string\_fields": {  
> "mapping": {  
> "fielddata": {  
> "format": "disabled"  
> },  
> "index": "not\_analyzed",  
> "omit\_norms": true,  
> "type": "string",  
> "fields": {  
> "raw": {  
> "ignore\_above": 256,  
> "index": "not\_analyzed",  
> "type": "string"  
> }  
> }  
> },  
> "match\_mapping\_type": "string",  
> "match": "_"  
> }  
> }  
> ],  
> "\_all": {  
> "omit\_norms": true,  
> "enabled": true  
> },  
> "properties": {  
> "@timestamp": {  
> "type": "date"  
> },  
> "geoip": {  
> "dynamic": true,  
> "properties": {  
> "ip": {  
> "type": "ip"  
> },  
> "latitude": {  
> "type": "float"  
> },  
> "location": {  
> "type": "geo\_point"  
> },  
> "longitude": {  
> "type": "float"  
> }  
> }  
> },  
> "@version": {  
> "index": "not\_analyzed",  
> "type": "string"  
> }  
> }  
> }  
> },  
> "aliases": {}  
> }  
> }'

my conf file is:

> [@](#):
>
> output {  
> elasticsearch {  
> hosts =\> ["localhost:9200"]  
> manage\_template =\> false  
> template =\> "C:\Users\1006541\Desktop\RAMA\template2.txt"  
> template\_name =\> "logstash\_indexPattern\_line"  
> action =\> "index"  
> index =\> "data2"  
> }  
> stdout {codec =\> rubydebug}  
> }

is this the correct way to do it? or am doing anything wrong? Please help me with my errors.

---

<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 9, 2016, 1:04pm UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483/2 "2016-11-09T13:04:39Z")

</div>

Your index is named data2 but your template matches data-\*.

---

<div class="post-metadata">

**Author:** ![setlem](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@setlem](https://discuss.elastic.co/u/setlem)\
**Post date:** [November 10, 2016, 9:19am UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483/3 "2016-11-10T09:19:54Z")

</div>

thanks for ur reply magnus.  
even though i changed it..i am not getting any output  
i am getting this in my cmd

> [@](#):
>
> ```
> "message" => "PATH=C:\\ProgramData\\Oracle\\Java\\javapath;C:\\windows\\s
> 
> ```
> 
> ystem32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPo  
> werShell\v1.0\;C:\Program Files\nodejs\;C:\windows\system32\config\syst  
> emprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files  
> \TortoiseGit\bin;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramDa  
> ta\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System  
> 32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nod  
> ejs\;C:\windows\system32\config\systemprofile\.dnx\bin;C:\Program Files  
> \Microsoft DNX\Dnvm\;C:\Program Files\TortoiseGit\bin;C:\windows\System32  
> \WindowsPowerShell\v1.0\;D:\ELK\_stack\logstash-2.4.0\r",  
> "@version" =\> "1",  
> "@timestamp" =\> "2016-11-10T08:44:14.371Z",  
> "path" =\> "C:\Users\1006541\Desktop\RAMA\input1.csv",  
> "host" =\> "01HW345434",  
> "ORDER\_ID" =\> "PATH=C:\ProgramData\Oracle\Java\javapath;C:\windows\s  
> ystem32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPo  
> werShell\v1.0\;C:\Program Files\nodejs\;C:\windows\system32\config\syst  
> emprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files  
> \TortoiseGit\bin;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramDa  
> ta\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System  
> 32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nod  
> ejs\;C:\windows\system32\config\systemprofile\.dnx\bin;C:\Program Files  
> \Microsoft DNX\Dnvm\;C:\Program Files\TortoiseGit\bin;C:\windows\System32  
> \WindowsPowerShell\v1.0\;D:\ELK\_stack\logstash-2.4.0"  
> }

---

<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 10, 2016, 9:24am UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483/4 "2016-11-10T09:24:27Z")

</div>

> even though i changed it..i am not getting any output

Output from what?

> i am getting this in my cmd

If you delete your existing index and let Logstash create a new one, is your index template applied as expected?

---

<div class="post-metadata">

**Author:** ![setlem](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@setlem](https://discuss.elastic.co/u/setlem)\
**Post date:** [November 10, 2016, 9:48am UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483/5 "2016-11-10T09:48:03Z")

</div>

Hi  
i am creating new new index for logstash.

> [@](#):
>
> Output from what?

the output I mentioned is the output I get when I run my config file in command prompt.

---

<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 10, 2016, 9:57am UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483/6 "2016-11-10T09:57:37Z")

</div>

What's the name of the index you're creating? Does it have the correct mappings?

---

<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:** [December 8, 2016, 9:57am UTC](https://discuss.elastic.co/t/creating-custom-elasticsearch-templates/65483/7 "2016-12-08T09:57:49Z")

</div>

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