# Using 'index per day' for index actions

**URL:** <https://discuss.elastic.co/t/using-index-per-day-for-index-actions/62909>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [October 13, 2016, 7:57am UTC](https://discuss.elastic.co/t/using-index-per-day-for-index-actions/62909 "2016-10-13T07:57:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![parw](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@parw](https://discuss.elastic.co/u/parw)\
**Post date:** [October 13, 2016, 7:57am UTC](https://discuss.elastic.co/t/using-index-per-day-for-index-actions/62909/1 "2016-10-13T07:57:39Z")

</div>

HI,

Can I name the index in an indexaction, so I get an index per day? Like:

```
        "index": {
            "index": "alerts-%{+YYYY.MM.dd}",
            "doc_type": "some_alert"
        }
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 13, 2016, 12:54pm UTC](https://discuss.elastic.co/t/using-index-per-day-for-index-actions/62909/2 "2016-10-13T12:54:07Z")

</div>

Hey,

so this example works and creates an alert named index with a date component:

```auto
PUT _xpack/watcher/watch/_execute
{
  "watch": {
    "trigger": {
      "schedule": {
        "interval": "5h"
      }
    },
    "input": {
      "simple": {
        "foo" : "bar"
      }
    },
    "actions": {
      "second" : {
         "index": {
            "index": "<alerts-{now/M}>",
            "doc_type": "some_alert"
        }
      }
    }
  }
}

```

--Alex

---

<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, 1:42pm UTC](https://discuss.elastic.co/t/using-index-per-day-for-index-actions/62909/3 "2017-07-06T13:42:35Z")

</div>


