How to insert evaluated some specific documents results into another elasticsearch index using watcher actions?

alerting

(Yash M.) #1

Hello Folks,

I want to insert evaluated documents on the basis of written condition in a separate elastic-search index other than .watcher-history using watcher Action . during this process i also want to associate some custom field & value to tag the documents.

Basically, I don't want all the unnecessary fields which ".watcher-history-*" index have. I want to push only original record & some custom field and values to tag them.

I will appreciate any small example in this direction.

-- Yash


(Alexander Reelsen) #2

You need to use a transform inside of your index action to create the document structure you want. Like this

{
  "transform" : {
    "script" : "return [ 'time' : ctx.trigger.scheduled_time ]" 
  }
}

Note, if you create a _doc array, you can also index multiple documents within a single index action.


(system) #3

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