0

I have a list of items retrieved from my query using aggregations. I want to print this list of items in my email with each appearing on a separate line. Right now I can print everything but it all appears one after the other i.e. file1.txt file2.txt. I would like for it to appear like

file1.txt
file2.txt

Below is the action to create the email.

"actions": {
    "email_users": {
        "email": {
            "profile": "standard",
            "to": [
                "jcarpenter@mydomain.com"
            ],
            "subject": "File Identifier",
            "body": {
                "html": "<p>Files could not be identified due bad receiver id.  There were {{ctx.payload.hits.total}} files that could not be identified.</p> <ul><li>{{#ctx.payload.aggregations.file_name.buckets}}{{key}}{{/ctx.payload.aggregations.file_name.buckets}}</li></ul>"
            }
        }
    }

Can I print the items this way?

James
  • 493
  • 1
  • 10
  • 37

1 Answers1

0

I was able to format the items using the following command.

"actions": {
"email_users": {
  "email": {
    "profile": "standard",
    "to": [
      "jcarpenter@mydomain.com"
    ],
    "subject": "File Identifier",
    "body": {
      "html": "<p>Files could not be identified due bad receiver id.  There were {{ctx.payload.hits.total}} files that could not be identified.</p> <div><ul>{{#ctx.payload.aggregations.file_name.buckets}}{{#key}}<li>{{.}}</li>{{/key}}{{/ctx.payload.aggregations.file_name.buckets}}</ul></div><p>These files have been sent to quarantine.</p>"
    }
  }
}
James
  • 493
  • 1
  • 10
  • 37