# How create index every 4 or 6 hours

**URL:** <https://discuss.elastic.co/t/how-create-index-every-4-or-6-hours/152687>\
**Category:** Elasticsearch\
**Created:** [October 16, 2018, 2:59pm UTC](https://discuss.elastic.co/t/how-create-index-every-4-or-6-hours/152687 "2018-10-16T14:59:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorinand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorinand/32/70521_2.png) [@dorinand](https://discuss.elastic.co/u/dorinand)\
**Post date:** [October 16, 2018, 2:59pm UTC](https://discuss.elastic.co/t/how-create-index-every-4-or-6-hours/152687/1 "2018-10-16T14:59:02Z")

</div>

I have cluster consist of 17 nodes. 3 masters, 12 data, 2 coordinating. My cluster consist of approximately 300 indices right now. Each index have 4 shards and set 2 replicas. Some of my indices has between 400-800 gb (there is just few of them) per day (included replicas). My cluster was so slow, often lost some node base on `translog already closed` error or `too many opened files`. On some nodes, I configure 409600 max open files. This is openfiles on my cluster:

```
+----------+----------+----------+----------+
| MAX FD | OPEN FD | DIFF |
+----------+----------+----------+----------+
| 131070 | 510 | 0.39 % | 130560 |
| 409600 | 1187 | 0.29 % | 408413 |
| 409600 | 6018 | 1.47 % | 403582 |
| 409600 | 102349 | 24.99 % | 307251 |
| 409600 | 1961 | 0.48 % | 407639 |
| 409600 | 85900 | 20.97 % | 323700 |
| 409600 | 2439 | 0.60 % | 407161 |
| 409600 | 126252 | 30.82 % | 283348 |
| 409600 | 1891 | 0.46 % | 407709 |
| 131070 | 2112 | 1.61 % | 128958 |
| 131070 | 2159 | 1.65 % | 128911 |
| 131070 | 2256 | 1.72 % | 128814 |
| 131070 | 80871 | 61.70 % | 50199 |
| 131070 | 512 | 0.39 % | 130558 |
| 131070 | 510 | 0.39 % | 130560 |
| 131070 | 496 | 0.38 % | 130574 |
| 131070 | 496 | 0.38 % | 130574 |
+----------+----------+----------+----------+

```

I think, it is too much openfiles, when i list them with `lsof -u elasticsearch`, more of them are translogs. I decide to set `refresh_interval` to `-1` and then `foceMerge` on all old indices older than one day. It helped a lot, but I would like to perform this changes also on big indices more often. So I would like to split them to more indices, eg per 4 or 6 hours. How can I do that? I thought at first use some `if` statements, but it does not look as a good idea. Then, there is option use ruby filter in logstash. Is that good idea or is that better solution for my problem?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 16, 2018, 3:02pm UTC](https://discuss.elastic.co/t/how-create-index-every-4-or-6-hours/152687/2 "2018-10-16T15:02:55Z")

</div>

Have a look at the [rollover index API](https://www.elastic.co/guide/en/elasticsearch/reference/6.4/indices-rollover-index.html), which allows you to trigger index creation based on age and/or size. This makes it easier to stay close to e.g. a target index or shard size.

---

<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:** [November 13, 2018, 3:02pm UTC](https://discuss.elastic.co/t/how-create-index-every-4-or-6-hours/152687/3 "2018-11-13T15:02:56Z")

</div>

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