How to do index multiple docs in watcher action

alerting

(Li Lu) #1

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 https://www.elastic.co/guide/en/watcher/current/actions.html#anatomy-actions-index-multi-doc-support

Thanks so much !

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

    }
}

(Alexander Reelsen) #2

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!

--Alex


(system) #3