In the below example I query for the snapshots to see if there is a failed status on any of them. In this one I'm pulling the first record and the number of shards that failed in the snapshot. How would I edit this so that I could loop the array and display this for every record vs just the first one? I tried to do some searches for looping through a return to send to the log, or eventually a email alert, but couldn't find anything. Any help would be appreciated.
"trigger": {
"schedule": {
"interval": "60s"
}
},
"input": {
"http": {
"request": {
"scheme": "http",
"host": "localhost",
"port": 9200,
"method": "get",
"path": "/_snapshot/s3_repository/_all",
"params": {},
"headers": {}
}
}
},
"condition": {
"always": {}
},
"actions": {
"logging": {
"logging": {
"text": "Shards failed in first returned record {{ctx.payload.snapshots.0.shards.failed}} "
}
}
}
}
Here is an example of what it returns on the simulation, I removed the list of indices would make it too long(I get about 12 of those right now that I'm trying to loop through to log the results:
{
"snapshot": "2018-02-23t03:15",
"uuid": "nIOUXhIsQLSKONnFSFCNBQ",
"version_id": 6020299,
"version": "6.2.2",
"indices": [
.. indices were removed here ..
],
"include_global_state": true,
"state": "SUCCESS",
"start_time": "2018-02-23T03:15:04.460Z",
"start_time_in_millis": 1519355704460,
"end_time": "2018-02-23T05:34:55.313Z",
"end_time_in_millis": 1519364095313,
"duration_in_millis": 8390853,
"failures": [],
"shards": {
"total": 909,
"failed": 0,
"successful": 909
}
},