{
"watch_id": "platform.wavespot.net",
"state": "execution_not_needed",
"status": {
"state": {
"active": true,
"timestamp": "2019-01-23T13:39:36.359Z"
},
"last_checked": "2019-01-23T13:45:37.506Z",
"last_met_condition": "2019-01-23T13:43:37.470Z",
"actions": {
"email_admin": {
"ack": {
"timestamp": "2019-01-23T13:39:36.359Z",
"state": "awaits_successful_execution"
},
"last_execution": {
"timestamp": "2019-01-23T13:43:37.470Z",
"successful": false,
"reason": "GeneralScriptException[Error running inline script [ Total {{ctx.payload.hits.total}} errors. Below are the errors from {{ctx.payload.hits.hits.0._source.beat.hostname}} \n {{ctx.payload.hits.hits.0._source.message}} \n {{ctx.payload.hits.hits.1._source.message}} \n {{ctx.payload.hits.hits.2._source.message}} \n {{ctx.payload.hits.hits.3._source.message}} \n {{ctx.payload.hits.hits.4._source.message}} \n {{ctx.payload.hits.hits.5._source.message}} \n {{ctx.payload.hits.hits.6._source.message}} \n {{ctx.payload.hits.hits.7._source.message}} \n {{ctx.payload.hits.hits.8._source.message}} \n {{ctx.payload.hits.hits.9._source.message}} \n] using lang [mustache]]; nested: MustacheException[Failed to get value for ctx.payload.hits.hits.3._source.message @[query-template:5]]; nested: MustacheException[3 @[query-template:5]]; nested: IndexOutOfBoundsException[3]; "
}
}
}
},
"trigger_event": {
"type": "schedule",
"triggered_time": "2019-01-23T13:45:37.506Z",
"schedule": {
"scheduled_time": "2019-01-23T13:45:37.078Z"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"platform.wavespot.net-"
],
"types": [],
"body": {
"size": 10,
"query": {
"bool": {
"must": {
"match": {
"message": "error"
}
},
"filter": {
"range": {
"@timestamp": {
"from": "now-2m",
"to": "now"
}
}
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"result": {
"execution_time": "2019-01-23T13:45:37.506Z",
"execution_duration": 5,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 80,
"failed": 0,
"successful": 80,
"skipped": 0
},
"hits": {
"hits": [],
"total": 0,
"max_score": null
},
"took": 4,
"timed_out": false
},
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"platform.wavespot.net-"
],
"types": ,
"body": {
"size": 10,
"query": {
"bool": {
"must": {
"match": {
"message": "error"
}
},
"filter": {
"range": {
"@timestamp": {
"from": "now-2m",
"to": "now"
}
}
}
}
}
}
}
}
},
"condition": {
"type": "compare",
"status": "success",
"met": false,
"compare": {
"resolved_values": {
"ctx.payload.hits.total": 0
}
}
},
"actions":
},
"messages":
}
I'm getting above error
My actual watcher is :
{
"trigger": {
"schedule": {
"interval": "2m"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"platform.wavespot.net-*"
],
"types": ,
"body": {
"size": 10,
"query": {
"bool": {
"must": {
"match": {
"message": "error"
}
},
"filter": {
"range": {
"@timestamp": {
"from": "now-2m",
"to": "now"
}
}
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"email_admin": {
"email": {
"profile": "standard",
"to": [
"Serverops serverops@something.com"
],
"subject": "Platform: JBOSS Errors from Watcher",
"body": {
"text": " Total {{ctx.payload.hits.total}} errors. Below are the errors from {{ctx.payload.hits.hits.0._source.beat.hostname}} \n {{ctx.payload.hits.hits.0._source.message}} \n {{ctx.payload.hits.hits.1._source.message}} \n {{ctx.payload.hits.hits.2._source.message}} \n {{ctx.payload.hits.hits.3._source.message}} \n {{ctx.payload.hits.hits.4._source.message}} \n {{ctx.payload.hits.hits.5._source.message}} \n {{ctx.payload.hits.hits.6._source.message}} \n {{ctx.payload.hits.hits.7._source.message}} \n {{ctx.payload.hits.hits.8._source.message}} \n {{ctx.payload.hits.hits.9._source.message}} \n"
}
}
}
}
}