# Send alerts to elasticsearch index with YYYY-MM placeholder

**URL:** <https://discuss.elastic.co/t/send-alerts-to-elasticsearch-index-with-yyyy-mm-placeholder/119854>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [February 14, 2018, 6:02pm UTC](https://discuss.elastic.co/t/send-alerts-to-elasticsearch-index-with-yyyy-mm-placeholder/119854 "2018-02-14T18:02:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Field](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_field/32/26599_2.png) [@Matthew\_Field](https://discuss.elastic.co/u/Matthew_Field)\
**Post date:** [February 14, 2018, 6:02pm UTC](https://discuss.elastic.co/t/send-alerts-to-elasticsearch-index-with-yyyy-mm-placeholder/119854/1 "2018-02-14T18:02:08Z")

</div>

I am trying to send x pack watcher alerts to an index using YYYY-MM-dd placeholders similar to the way I do in logstash.

eg. my-index-2018-01-01 , my-index-2018-01-02 etc. as a function of todays date.

Something like this:

```auto
.....
 "index_payload": {
      "transform": {
        "script": "return ['clientId' : ctx.metadata.clientId ,'clientName':'Matts Testing Locations','docType':'watcher-alert','location_pg':'0,0']"
      },
      "index": {
        "index": "my-index-{{YYYY-MM-DD}}",
        "doc_type": "doc",
        "execution_time_field": "execution_time"
      }

```

But I can't find the right place holder format to use.  
Thanks for any help!

---

<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:** [February 14, 2018, 8:13pm UTC](https://discuss.elastic.co/t/send-alerts-to-elasticsearch-index-with-yyyy-mm-placeholder/119854/2 "2018-02-14T20:13:56Z")

</div>

See this link [https://www.elastic.co/guide/en/elasticsearch/reference/6.2/date-math-index-names.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/date-math-index-names.html)

---

<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:** [March 14, 2018, 8:14pm UTC](https://discuss.elastic.co/t/send-alerts-to-elasticsearch-index-with-yyyy-mm-placeholder/119854/3 "2018-03-14T20:14:11Z")

</div>

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