Thank you very much for your help! At first I thought that was the answer. It turns out, the response still indicates a 'null' like this: "ctx.payload.hits.hits[0]._source.Value": null.
Why does the alert not triggered as expected?
The response is like this (it is still the same) :
{
"watch_id": "Voltage-AB-Watcher2",
"state": "execution_not_needed",
"_status": {
"state": {
"active": true,
"timestamp": "2017-06-27T07:27:38.068Z"
},
"last_checked": "2017-06-27T07:27:58.149Z",
"actions": {
"logging": {
"ack": {
"timestamp": "2017-06-27T07:27:38.068Z",
"state": "awaits_successful_execution"
}
}
}
},
"trigger_event": {
"type": "schedule",
"triggered_time": "2017-06-27T07:27:58.149Z",
"schedule": {
"scheduled_time": "2017-06-27T07:27:58.040Z"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"test-1"
],
"types": [
"Test1"
],
"body": {
"query": {
"match_all": {}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.hits[0]._source.Value": {
"gt": 400
}
}
},
"metadata": {
"name": "Voltage-AB-Watcher2"
},
"result": {
"execution_time": "2017-06-27T07:27:58.149Z",
"execution_duration": 2,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 5,
"failed": 0,
"successful": 5
},
"hits": {
"hits": [
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-13T14:30:00.000Z",
"LowerThreshold": "380",
"Value": "415",
"UpperThreshold": "450"
},
"_id": "AVyiFsRyTbYjGVwV_rPd",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-13T16:10:00.000Z",
"LowerThreshold": "380",
"Value": "420",
"UpperThreshold": "450"
},
"_id": "AVyiE1t5TbYjGVwV_rG-",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-13T16:50:00.000Z",
"LowerThreshold": "380",
"Value": "410",
"UpperThreshold": "450"
},
"_id": "AVyiFD-_TbYjGVwV_rJL",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-13T15:00:00.000Z",
"LowerThreshold": "380",
"Value": "425",
"UpperThreshold": "450"
},
"_id": "AVyiFdJxTbYjGVwV_rM0",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-11T06:00:00.000Z",
"LowerThreshold": "380",
"Value": "400",
"UpperThreshold": "450"
},
"_id": "AVys8d9PfS18ne-HaHbs",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-11T11:00:00.000Z",
"LowerThreshold": "380",
"Value": "390",
"UpperThreshold": "450"
},
"_id": "AVys8jUwfS18ne-HaHcu",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-11T19:00:00.000Z",
"LowerThreshold": "380",
"Value": "400",
"UpperThreshold": "450"
},
"_id": "AVys8t7YfS18ne-HaHev",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-11T23:00:00.000Z",
"LowerThreshold": "380",
"Value": "410",
"UpperThreshold": "450"
},
"_id": "AVys8wMmfS18ne-HaHfR",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-12T06:00:00.000Z",
"LowerThreshold": "380",
"Value": "400",
"UpperThreshold": "450"
},
"_id": "AVys82zqfS18ne-HaHgx",
"_score": 1
},
{
"_index": "test-1",
"_type": "Test1",
"_source": {
"date": "2017-06-11T20:00:00.000Z",
"LowerThreshold": "380",
"Value": "400",
"UpperThreshold": "450"
},
"_id": "AVys8uW9fS18ne-HaHew",
"_score": 1
}
],
"total": 83,
"max_score": 1
},
"took": 1,
"timed_out": false
},
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"test-1"
],
"types": [
"Test1"
],
"body": {
"query": {
"match_all": {}
}
}
}
}
},
"condition": {
"type": "compare",
"status": "success",
"met": false,
"compare": {
"resolved_values": {
"ctx.payload.hits.hits[0]._source.Value": null
}
}
},
"actions":
},
"messages":
}