Sending Payload with email alert

Dear team,
I have a watcher as below. I wish to send payload with my email, but below is displaying result as: "Hit Count : 7 Other test: "
Kindly help me in this regards.

{
"actions": {
"Email_alarm_4bb3efa5-8b8b-4237-a037-19a5fdd7db8f": {
"name": "!!! Alert !!!",
"throttle_period": "1m",
"email": {
"priority": "high",
"stateless": false,
"body": "Hit Count : {{payload.hits.total}} Other {{payload.hits.text}} test: {{payload.hits.hits[1].total_points}}}",
"to": "abc@wer.com",
"from": "kibana@wer.com",
"subject": "TX amount bw 10000 and 10001"
}
}
},
"input": {
"search": {
"request": {
"index": [
"apek_01"
],
"body": {
"query": {
"bool": {
"must": [
{
"range": {
"txn_amount": {
"gte": 10000,
"lte": 10001
}
}
},
{
"range": {
"request_time": {
"gte": "now-10000h/h"
}
}
}
]
}
}
}
}
}
},
"condition": {
"script": "payload.hits.total > 0; String payload.hits.text; for (int i = 0; i <= payload.hits.total; i++){payload.hits.text += 'Id Event: ' + payload.hits.hits[i]._source.txn_id + '\n';} return payload.hits.text;"
},
"trigger": {
"schedule": {
"later": "every 1 minutes"
}
},
"disable": true,
"report": true,
"title": "Watcher_test_001",
"save_payload": true,
"spy": false,
"impersonate": false
}

Regards.

Hi, the best source to go for Watcher DSL help is the Elasticsearch category in this forum.

Also, pro tip: always use code formatting around text that needs to keep its pre-formatting. The icon is the markup brackets: </>

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