# How to create Index Every five 5 Minute

**URL:** <https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796>\
**Category:** Logstash\
**Created:** [July 30, 2016, 6:41pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796 "2016-07-30T18:41:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [July 30, 2016, 6:41pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/1 "2016-07-30T18:41:33Z")

</div>

Hi All,

Basically I am pulling data from SQL Server into ES.I am able to create Index daily, hourly, minute, second etc ..but i want to create every 5 minute new index ..anybody knows how i can do this?

Is there any way to give elasticsearch output plugin index name into other output plugin lets say exec, pip?

Thanks,  
Sumit

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [July 30, 2016, 7:39pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/2 "2016-07-30T19:39:24Z")

</div>

Are you sure you want to do that? You might overload on shard count per node with an approach like that.

---

<div class="post-metadata">

**Author:** ![Hans](https://avatars.discourse-cdn.com/v4/letter/h/e19b73/32.png) [@Hans](https://discuss.elastic.co/u/Hans)\
**Post date:** [July 30, 2016, 9:10pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/3 "2016-07-30T21:10:34Z")

</div>

Here is how you can create one every minute:  
index =\> "logstash-%{+YYYY-MM-dd\_hh:mm}"

---

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [July 30, 2016, 9:25pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/4 "2016-07-30T21:25:50Z")

</div>

Hi Aaron,

Thanks for your quick response.  
That's OK for me i am going to keep only 5 minute Data.

Thanks,  
Sumit

---

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [July 30, 2016, 9:28pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/5 "2016-07-30T21:28:25Z")

</div>

Hi Hans,

Basically if you are going to pull from RDBMS and if logstash taking more then 59 Seconds then it will create new Index that is on minute basis..So using this you can create minute wise index not abjectly 5 Minutes.

Thanks,  
Sumit

---

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [July 31, 2016, 7:37am UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/6 "2016-07-31T07:37:49Z")

</div>

Hi Aaron,

Anything Can we do something like this:  
Is there any way to give elasticsearch output plugin index name into other output plugin lets say exec, pip?

Thanks,  
Sumit

---

<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:** [July 31, 2016, 2:54pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/7 "2016-07-31T14:54:52Z")

</div>

> Is there any way to give elasticsearch output plugin index name into other output plugin lets say exec, pip?

I'm not sure I get what you mean, but you can of course reuse the same value that you pass to the elasticsearch output's `index` option in other places. If you explain what you want to accomplish it might be easier to help out.

---

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [August 1, 2016, 5:13am UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/8 "2016-08-01T05:13:48Z")

</div>

Hi,

It is simple lets say for example:

output {  
elasticsearch {  
index =\> "hdap\_%{+YYYY-MM-dd\_hh:mm}"  
}  
exec {  
command =\> "echo %{index}"  
}  
}

So basically i want to pass index name in my shell script.

Thanks,  
Sumit

---

<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 1, 2016, 2:08pm UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/9 "2016-08-01T14:08:51Z")

</div>

```
command => "echo hdap_%{+YYYY-MM-dd_hh:mm}"
```

---

<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:45am UTC](https://discuss.elastic.co/t/how-to-create-index-every-five-5-minute/56796/10 "2017-07-06T04:45:36Z")

</div>


