# Is there a way to use logstash template without specifying index name as "logstash-\*" when using Elasticsearch output plugin?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-use-logstash-template-without-specifying-index-name-as-logstash-when-using-elasticsearch-output-plugin/51906>\
**Category:** Logstash\
**Created:** [June 6, 2016, 6:47am UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-logstash-template-without-specifying-index-name-as-logstash-when-using-elasticsearch-output-plugin/51906 "2016-06-06T06:47:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![timogoosen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timogoosen/32/29750_2.png) [@timogoosen](https://discuss.elastic.co/u/timogoosen)\
**Post date:** [June 6, 2016, 6:47am UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-logstash-template-without-specifying-index-name-as-logstash-when-using-elasticsearch-output-plugin/51906/1 "2016-06-06T06:47:07Z")

</div>

I know when you output tot Elasticsearch and you specify your index name to output to as "logstash-_"  
then your output also contains raw fields. This is because when you use index name "logstash-_" then it uses the logstash template which has a mapping that also maps fields as .raw. How do I tell logstash to use this template, but instead of outputting my output to an index named "logstash-_" then I use another index name for example  
"webserver-_"?  
Hope this makes sense.  
I know I can specify my own template and use that, but I specifically want to use the logstash-\* template.

Regards.

---

<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:** [June 6, 2016, 7:01am UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-logstash-template-without-specifying-index-name-as-logstash-when-using-elasticsearch-output-plugin/51906/2 "2016-06-06T07:01:18Z")

</div>

You need to copy the existing template and rename it.  
Use the `_templates` API endpoint for that.

---

<div class="post-metadata">

**Author:** ![bryan\_stuhlsatz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_stuhlsatz/32/49123_2.png) [@bryan\_stuhlsatz](https://discuss.elastic.co/u/bryan_stuhlsatz)\
**Post date:** [June 6, 2016, 10:39am UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-logstash-template-without-specifying-index-name-as-logstash-when-using-elasticsearch-output-plugin/51906/3 "2016-06-06T10:39:02Z")

</div>

Right. And also change your Logstash output section to reflect your new index name. I personally don't use the default Logstash... I name my indexes after the type of data I'm storing, and have a template for each one.

---

<div class="post-metadata">

**Author:** ![timogoosen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timogoosen/32/29750_2.png) [@timogoosen](https://discuss.elastic.co/u/timogoosen)\
**Post date:** [June 14, 2016, 7:02am UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-logstash-template-without-specifying-index-name-as-logstash-when-using-elasticsearch-output-plugin/51906/4 "2016-06-14T07:02:12Z")

</div>

That was what I was implying that I specify my own name for each index, but what I wanted to know is if I can use the logstash template without having to copy it to a file and pointing the index to the template file in my logstash template.

---

<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 6, 2017, 4:53am UTC](https://discuss.elastic.co/t/is-there-a-way-to-use-logstash-template-without-specifying-index-name-as-logstash-when-using-elasticsearch-output-plugin/51906/5 "2017-07-06T04:53:09Z")

</div>


