How to do index multiple docs in watcher action

I have a watcher. I want every time when the watcher got triggered, some (maybe 0, 1 or more than 1) documents can be inserted into an index based on the aggregation result.

The action looks like below in my watcher test, but it does not work.
I want to insert 2 docs: {foo: bar1}, {foo: bar2}
There is no example for

Thanks so much !

"actions": {
"put_daily_agg": {
"transform" : {
"script" : "return _doc : [foo : bar1, foo: bar2]"
"index": {
"index" : "my-index",
"doc_type" : "my-type"


Hey there,

check the documentation about index multiple docs in combination with a transform as well as this discussion in this forum, which yields an example.

That should help you to get up and running!