# Date math index name throwing error in Watcher input

**URL:** <https://discuss.elastic.co/t/date-math-index-name-throwing-error-in-watcher-input/290638>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [December 1, 2021, 7:59am UTC](https://discuss.elastic.co/t/date-math-index-name-throwing-error-in-watcher-input/290638 "2021-12-01T07:59:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Munavir\_Chavody](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/munavir_chavody/32/87951_2.png) [@Munavir\_Chavody](https://discuss.elastic.co/u/Munavir_Chavody)\
**Post date:** [December 1, 2021, 7:59am UTC](https://discuss.elastic.co/t/date-math-index-name-throwing-error-in-watcher-input/290638/1 "2021-12-01T07:59:15Z")

</div>

I've the date math name in one of the watcher search input as below.

```auto
"indices": ["<.watcher-history-13-{now/d}>"]

```

But the execution fails with below error.

```auto
"result": {
    "execution_time": "2021-12-01T07:57:46.049Z",
    "execution_duration": 1732,
    "input": {
      "type": "chain",
      "status": "failure",
      "error": {
        "root_cause": [
          {
            "type": "null_pointer_exception",
            "reason": "Cannot invoke \"org.elasticsearch.xpack.core.watcher.watch.Payload.data()\" because the return value of \"org.elasticsearch.xpack.core.watcher.input.Input$Result.payload()\" is null"
          }
        ],
        "type": "null_pointer_exception",
        "reason": "Cannot invoke \"org.elasticsearch.xpack.core.watcher.watch.Payload.data()\" because the return value of \"org.elasticsearch.xpack.core.watcher.input.Input$Result.payload()\" is null"
      },
      "chain": {}
    },
    "actions": []
  }

```

Same search works well from the console. Also, if I change the number 13 to something else(i.e., non existent index) search completes without any error.

What could be the issue here?

---

<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:** [December 15, 2021, 4:05pm UTC](https://discuss.elastic.co/t/date-math-index-name-throwing-error-in-watcher-input/290638/2 "2021-12-15T16:05:41Z")

</div>

which version are you trying this against? As the `13` is an internal implementation detail and might change after an upgrade, using this is probably not a good idea... any chance of just querying the full history indices and write a query using a timestamp? Or isn't that an option?

---

<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:** [January 12, 2022, 4:06pm UTC](https://discuss.elastic.co/t/date-math-index-name-throwing-error-in-watcher-input/290638/3 "2022-01-12T16:06:16Z")

</div>

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