# How to use index template file?

**URL:** <https://discuss.elastic.co/t/how-to-use-index-template-file/28147>\
**Category:** Elasticsearch\
**Created:** [August 27, 2015, 1:12am UTC](https://discuss.elastic.co/t/how-to-use-index-template-file/28147 "2015-08-27T01:12:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kikuchan](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@kikuchan](https://discuss.elastic.co/u/kikuchan)\
**Post date:** [August 27, 2015, 1:12am UTC](https://discuss.elastic.co/t/how-to-use-index-template-file/28147/1 "2015-08-27T01:12:27Z")

</div>

I created the index template file, but it could not apply to the Elasticsearch.  
I put the index template file to the $/home/config/templates/japanese\_template.json  
When I create the index by the logstash which used output plugin "elasticsearch", the index template file could not apply to the index.  
could you please let me know What is wrong.

following contents are the index template file.

## ・index template file

## { "japanese\_template":{ "template":"_", "settings":{ "analysis":{ "filter":{ "pos\_filter":{ "type":"kuromoji\_part\_of\_speech", "stoptags":["助詞-格助詞-一般", "助詞-終助詞"] }, "greek\_lowercase\_filter":{ "type":"lowercase", "language":"greek" } }, "tokenizer":{ "kuromoji":{ "type":"kuromoji\_tokenizer" }, "ngram\_tokenizer":{ "type":"nGram", "min\_gram":"2", "max\_gram":"3", "token\_chars":["letter", "digit"] } }, "analyzer":{ "kuromoji\_analyzer":{ "type":"custom", "tokenizer":"kuromoji", "filter":["kuromoji\_baseform", "pos\_filter", "greek\_lowercase\_filter", "cjk\_width"] }, "ngram\_analyzer":{ "tokenizer":"ngram\_tokenizer" } } } }, "mappings" : { "default":{ "dynamic\_templates":[{ "string\_template":{ "mapping":{ "index":"not\_analyzed", "type":"string" }, "match\_mapping\_type":"string", "match":"_" } }], "properties":{ "KJ\_ID":{ "type":"integer" }, "TITLE":{ "type":"string", "store":"yes", "index":"analyzed", "analyzer":"kuromoji\_analyzer" }, "USER\_ID":{ "type":"multi\_field", "fields":{ "no\_analyzed":{ "index":"not\_analyzed", "type":"string" }, "analyzed":{ "index":"analyzed", "type":"string" } } }, "REGIST\_DATE\_TIME":{ "type":"multi\_field", "fields":{ "no\_analyzed":{ "index":"not\_analyzed", "type":"string" }, "analyzed":{ "index":"analyzed", "type":"string" } } }, "UPDATE\_DATE\_TIME":{ "type":"date", "store":"yes", "format":"yyyy-MM-dd hh:mm:ss" }, "UPDATE\_FLG":{ "type":"boolean" } } } } } }

and I used the following logstash's config file.

## ・config file

input {  
file {  
path =\> "C:\elastic\logstash-1.5.3\conf\test1.csv"  
type =\> "Kiji"  
start\_position =\> "beginning"  
}  
}

## filter { csv { columns =\> ["KJ\_ID","TITLE","USER\_ID","REGIST\_DATE\_TIME","UPDATE\_DATE\_TIME","UPDATE\_FLG"] separator =\> "," } } output { elasticsearch{ action =\> "index" host =\> "localhost" index =\> "test1" protocol =\> "transport" cluster =\> "clustername" } }

If you have a solution, please help me.

sincerely

---

<div class="post-metadata">

**Author:** ![tuantm](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@tuantm](https://discuss.elastic.co/u/tuantm)\
**Post date:** [August 27, 2015, 1:52am UTC](https://discuss.elastic.co/t/how-to-use-index-template-file/28147/2 "2015-08-27T01:52:29Z")

</div>

The output configuration of Logstash should be:

```
elasticsearch {
      host => ['your_es_ip ']
      manage_template => false
      template => 'path_to_your_index_template'
}
```

---

<div class="post-metadata">

**Author:** ![kikuchan](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@kikuchan](https://discuss.elastic.co/u/kikuchan)\
**Post date:** [August 27, 2015, 3:48am UTC](https://discuss.elastic.co/t/how-to-use-index-template-file/28147/3 "2015-08-27T03:48:14Z")

</div>

@tuantm  
thanks for comment.

I modified the config file, but it didn't apply to index.  
all columns type became the "string"

## ・config file

input {  
file {  
path =\> "C:\elastic\logstash-1.5.3\conf\test1.csv"  
type =\> "Kiji"  
start\_position =\> "beginning"  
}  
}

filter {  
csv {  
columns =\> ["KJ\_ID","TITLE","USER\_ID","REGIST\_DATE\_TIME","UPDATE\_DATE\_TIME","UPDATE\_FLG"]  
separator =\> ","  
}  
}  
output  
{  
elasticsearch{  
action =\> "index"  
host =\> ["XXX.XXX.XXX.XXX"]  
manage\_template =\> false  
template =\> "C:\home\config\template\japanse\_template.json"  
template\_name =\> "japanese\_template"  
index =\> "test1"  
protocol =\> "transport"  
cluster =\> "clustername"  
}  
}

why can't I do?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 27, 2015, 5:26am UTC](https://discuss.elastic.co/t/how-to-use-index-template-file/28147/4 "2015-08-27T05:26:21Z")

</div>

Is that the exact file you are using, cause it doesn't look right.

---

<div class="post-metadata">

**Author:** ![kikuchan](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@kikuchan](https://discuss.elastic.co/u/kikuchan)\
**Post date:** [August 27, 2015, 5:46am UTC](https://discuss.elastic.co/t/how-to-use-index-template-file/28147/5 "2015-08-27T05:46:38Z")

</div>

@tuantm  
@warkolm

thanks for your comments.  
I reviewed the index template file and modified it, so I could use the index template file.

thank you for helping me!!

sincerely.

---

<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:** [July 5, 2017, 11:53pm UTC](https://discuss.elastic.co/t/how-to-use-index-template-file/28147/6 "2017-07-05T23:53:35Z")

</div>


