# 'Invalid watch actions' when saving/creating a watcher that simulates correctly

**URL:** <https://discuss.elastic.co/t/invalid-watch-actions-when-saving-creating-a-watcher-that-simulates-correctly/239834>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [July 3, 2020, 4:21pm UTC](https://discuss.elastic.co/t/invalid-watch-actions-when-saving-creating-a-watcher-that-simulates-correctly/239834 "2020-07-03T16:21:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rom1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rom1/32/49699_2.png) [@Rom1](https://discuss.elastic.co/u/Rom1)\
**Post date:** [July 3, 2020, 4:21pm UTC](https://discuss.elastic.co/t/invalid-watch-actions-when-saving-creating-a-watcher-that-simulates-correctly/239834/1 "2020-07-03T16:21:00Z")

</div>

Dear all,

I created a watcher through the Kibana UI that search for documents and index results into a new index.  
It works fine when I simulate it, even with execution of actions (target index is populated)

But

- when I want to create it (by pushing the 'create watch' button) I have the message 'invalid watch actions'
- Then I created it with a query 'PUT \_watcher/watch/...' successfully but when I look at the watchers through Kibana (Management/Watcher) the state is 'Config error' with the same message when I focus on my watcher.
- The action 'index\_evt\_type' contains errors 'JSON argument must contain an actionJson.index.index property'

```auto
{
  "trigger": {
    "schedule": {
      "interval": "12h"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "index-data"
        ],
        "rest_total_hits_as_int": true,
        "body": {
          "size": 0,
          "query": {
            "bool": {
              "filter": [
                {
                  "range": {
                    "@timestamp": {
                      "gte": "now-1h",
                      "lte": "now"
                    }
                  }
                },
                {
                  "match_all": {}
                }
              ]
            }
          },
          "aggs": {
            "evt_type": {
              "terms": {
                "field": "evt.type",
                "size": 100
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "always": {}
  },
  "actions": {
    "index_evt_type": {
      "transform": {
        "script": {
          "source": "def documents = ctx.payload.aggregations.evt_type.buckets.stream().map(bucket -> ['_index': 'index-liste', '_id': 'evt.type.' + bucket.key, 'evt.type': bucket.key, 'tech.data.type': 'evt.type']).collect(Collectors.toList());return ['_doc' : documents];",
          "lang": "painless"
        }
      },
      "index": {}
    }
  }
}

```

Does someone have any idea of what's happening ?

---

<div class="post-metadata">

**Author:** ![Rom1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rom1/32/49699_2.png) [@Rom1](https://discuss.elastic.co/u/Rom1)\
**Post date:** [July 3, 2020, 4:23pm UTC](https://discuss.elastic.co/t/invalid-watch-actions-when-saving-creating-a-watcher-that-simulates-correctly/239834/2 "2020-07-03T16:23:32Z")

</div>

Found it:  
"index": { "index": "index-liste" }

---

<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 31, 2020, 4:33pm UTC](https://discuss.elastic.co/t/invalid-watch-actions-when-saving-creating-a-watcher-that-simulates-correctly/239834/3 "2020-07-31T16:33:44Z")

</div>

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