Ctx.payload.hits.hits in a tabular format within email box

Hi there,

Following the Jan 20 2018 post, "Include fields in watcher email alert"

How to transform payload hits into a table format, making it easy to read for end-users? Running this format as a stand-alone JSON phrase does not produce a tabular result.
So far: Please see Example: 2 Keys, Runs OK. Just looking to format as a Table.

Thank you,

Hi there, have you taken a look at Watcher Email has Incorrect Format Using Mustache Template? This user also asked about formatting of tables in HTML. For that user, they were able to define a body like this to create an HTML table:

<head> <h1>Long Running Processes</h1> </head> <body> <table> <tr><th>Number
     1</th> <th>Number 2</th> </tr>{{#ctx.payload.hits.hits}} <tr><td>1</td> <td>2</td> </tr>
     {{/ctx.payload.hits.hits}}</table> </body>

I think you could adapt this to your use case too.

Hope this helps,
CJ

1 Like

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