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

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

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.

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