Need to check two conditions with test type, for eg we have two types of test
RTPCR and Antigen. we need to get an alert if the count of Antigen tests with positive cases is greater than 70% of RTPCR's positive case count in the last 1 hr. Also,
we need to check at least 500 tests must be done.
Can anyone please support me? Not sure the Must case can be done like this and in condition I need to check the Antigen test positive count is > 70%
{
"watch": {
"trigger": {
"schedule": {
"interval": "1h"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"test-*"
],
"rest_total_hits_as_int": true,
"body": {
"size": 0,
"query": {
"bool": {
"filter": {
"range": {
"@timestamp": {
"gte": "{{ctx.trigger.scheduled_time}}||-1h",
"lte": "{{ctx.trigger.scheduled_time}}",
"format": "strict_date_optional_time||epoch_millis"
}
}
},
"must": [
{
"first": {
"match": {
"test": "RTCPR"
},
"match": {
"result": "postive"
},
}
},
"second": {
"match": {
"test": "Antigen"
},
"match": {
"result": "postive"
},
}
"condition": {
"compare": {
"script": {
"inline": "ctx.payload.first >=100 && ctx.payload.second >=100 "
}
}
},
"actions": {
"notify-slack": {
"slack": {
"account": "Test-Bot",
"message": {
"from": "Test-Bot",
"to": [
"#Test-notification"
],
"text": "Test Count",
"attachments": [
{
"color": "danger",
"title": "Test Count",
"text": "SMS Lock down "
}
]
}
}
}
}
}