# Logstash Elasticsearch Output Plugin (Index)

**URL:** https://discuss.elastic.co/t/logstash-elasticsearch-output-plugin-index/59007
**Category:** Logstash
**Created:** [August 26, 2016, 6:31am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-output-plugin-index/59007 "2016-08-26T06:31:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jamesl](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jamesl](https://discuss.elastic.co/u/jamesl)
#### Post date: [August 26, 2016, 6:31am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-output-plugin-index/59007/1 "2016-08-26T06:31:10Z")

</div>

Hi.  
In the following configuration I would like to name my index and document\_type to have the 'type' field automatically put in instead of having to manually write it out.  
Extract of output LS file:

} else if [type] == "wineventlog" {  
elasticsearch {  
hosts =\> ["els03","els04"]  
sniffing =\> true  
manage\_template =\> false  
index =\> "wineventlog-%{+YYYY.MM.dd}"  
document\_type =\> "wineventlog"

Thanks.

---

<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: [August 26, 2016, 7:35am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-output-plugin-index/59007/2 "2016-08-26T07:35:03Z")

</div>

See [https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf).

---

<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:41am UTC](https://discuss.elastic.co/t/logstash-elasticsearch-output-plugin-index/59007/3 "2017-07-06T04:41:29Z")

</div>


