Watcher : Email Action : How to use attributes with special characters in the name

I have a query result where the source has some attributes with speical chars in name

ctx.payload.hits.hits[0]._source['@msg']

and I want to send these attributes in a watcher email action.

however these kind of attributes never work under the transform => script => source section
I tried many things like replacing the attribute with _ etc , using a varible like
def attr = '@msg'
but nothing works

below is a sample example (formatted the source string for easy understanding

    "transform": {
        "script": {
          "source": "ctx.payload.transform = [];
                    def document = [];     
                    for (int j = 0; j < ctx.payload.hits.hits.length; j++) {
                      def src = ctx.payload.hits.hits[j]._source;    
                      document = ['details':  src['@mt'] ];  
                      ctx.payload.transform.add(document); 
                    }     
                    return ctx.payload.transform;",
          "lang": "painless"
        }
      }

Kindly suggest any way to access these attribute in the watchers email painless script please.

Thanks in advance

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