Hi Alex,
Sorry to interrupt you but still no luck
I added array index 0 in below code:
PUT _xpack/watcher/watch/heartbeat
{
"trigger": {
"schedule": {
"interval": "1h"
}
},
"input": {
"search": {
"request": {
"indices": ".heartbeat-*",
"types": "doc",
"body": {
"query": {
"match_all": {}
}
}
}
}
},
"condition": {
"compare":{
"ctx.payload.hits.hits.0._source.up": {
"eq": "false"
}
}
},
"actions": {
"send_email" : {
"email": {
"to": "email Id",
"subject": "executed",
"body": "message"
}
}
}
}
I am getting exception while executing:
{
"_id": "heartbeat_d2cfc343-49f6-48ff-9153-dbaf0be63515-2017-11-15T08:19:18.477Z",
"watch_record": {
"watch_id": "heartbeat",
"state": "failed",
"status": {
"state": {
"active": true,
"timestamp": "2017-11-15T08:18:55.832Z"
},
"actions": {
"send_email": {
"ack": {
"timestamp": "2017-11-15T08:18:55.832Z",
"state": "awaits_successful_execution"
}
}
}
},
"trigger_event": {
"type": "manual",
"triggered_time": "2017-11-15T08:19:18.477Z",
"manual": {
"schedule": {
"scheduled_time": "2017-11-15T08:19:18.477Z"
}
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
".heartbeat-*"
],
"types": [
"doc"
],
"body": {
"query": {
"match_all": {}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.hits.0._source.up": {
"eq": "false"
}
}
},
"result": {
"execution_time": "2017-11-15T08:19:18.477Z",
"execution_duration": 0,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 0,
"failed": 0,
"successful": 0,
"skipped": 0
},
"hits": {
"hits": [],
"total": 0,
"max_score": 0
},
"took": 0,
"timed_out": false
},
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
".heartbeat-*"
],
"types": [
"doc"
],
"body": {
"query": {
"match_all": {}
}
}
}
}
},
"actions": []
},
"exception": {
"type": "index_out_of_bounds_exception",
"reason": "Index: 0, Size: 0"
}
}
}