Hi!
I'm trying to figure out a watcher with condition on the amount of hits, but the evaluation always turns out null
an watcher execution (with in my mind 3 hits) gives
"compare": {
"resolved_values": {
"ctx.payload.hits.total.value": null
}
Why? I'm missing something simple I know...
The result of the execution
{
"watch_id": "log_major_watch",
"node": "EGj-4JoFSPe6xWjD3374vQ",
"state": "execution_not_needed",
"user": "elastic",
"status": {
"state": {
"active": true,
"timestamp": "2020-08-19T13:51:27.700Z"
},
"last_checked": "2020-08-19T18:49:27.965Z",
"actions": {
"log_error": {
"ack": {
"timestamp": "2020-08-19T13:51:27.700Z",
"state": "awaits_successful_execution"
}
}
},
"execution_state": "execution_not_needed",
"version": -1
},
"trigger_event": {
"type": "schedule",
"triggered_time": "2020-08-19T18:49:27.965Z",
"schedule": {
"scheduled_time": "2020-08-19T18:49:27.703Z"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"business"
],
"rest_total_hits_as_int": true,
"body": {
"query": {
"bool": {
"must": [
{
"match": {
"value.ACTIVITY_DETECTION_STATUS": "Major"
}
}
],
"filter": [
{
"range": {
"value.MEASUREMENT_START_TIMESTAMP": {
"gte": "now-5m/m",
"lte": "now/m"
}
}
}
]
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total.value": {
"gt": 0
}
}
},
"result": {
"execution_time": "2020-08-19T18:49:27.965Z",
"execution_duration": 860,
"input": {
"type": "search",
"status": "success",
"payload": {
"_shards": {
"total": 1,
"failed": 0,
"successful": 1,
"skipped": 0
},
"hits": {
"hits": [
{
"_index": "business",
"_type": "_doc",
"_source": {
"@timestamp": "2020-08-19T18:49:21.578Z",
"@version": "1",
"@odata.context": "dsadadarnity.odata/v2.0/$metadata_1597862962258,BUSINESS_ACTIVITIES_RAW,0,USER_DEPARTMENT,OS_Name,Browser,Client_Device_Name,Activity_Detection_Status,Location_City,Measurement_Start_Timestamp,Activity_Backend_Time,Activity_Client_Time,Activity_Network_Time,SLA_Status,Activity_Name,Application_Name#BUSINESS_ACTIVITIES_RAW(ACTIVITY_BACKEND_TIME,ACTIVITY_CLIENT_TIME,ACTIVITY_DETECTION_STATUS,ACTIVITY_NAME,ACTIVITY_NETWORK_TIME,APPLICATION_NAME,BROWSER,CLIENT_DEVICE_NAME,LOCATION_CITY,MEASUREMENT_START_TIMESTAMP,OS_NAME,SLA_STATUS,USER_DEPARTMENT)",
"document_id": "732a4409a79f1fb45e7306e04aa072e1",
"value": {
"ACTIVITY_NAME": "Sök kund",
"BROWSER": "Chrome",
"ACTIVITY_NETWORK_TIME": 0.158,
"OS_NAME": "MS Windows 10",
"CLIENT_DEVICE_NAME": "adadad",
"ACTIVITY_BACKEND_TIME": 3.963,
"SLA_STATUS": "Major",
"USER_DEPARTMENT": "Skadeservice SOS",
"LOCATION_CITY": "Not Mapped",
"ACTIVITY_DETECTION_STATUS": "Major",
"MEASUREMENT_START_TIMESTAMP": "2020-08-19T20:45:53+02:00",
"ACTIVITY_CLIENT_TIME": 8.161,
"APPLICATION_NAME": "Y75"
}
},
"_id": "732a4409a79f1fb45e7306e04aa072e1",
"_score": 3.8933482
},
{
"_index": "business",
"_type": "_doc",
"_source": {
"@timestamp": "2020-08-19T18:49:21.578Z",
"@version": "1",
"@odata.context": "https://eu-odata.aternity.com/aternity.odata/v2.0/$dadad,BUSINESS_ACTIVITIES_RAW,0,USER_DEPARTMENT,OS_Name,Browser,Client_Device_Name,Activity_Detection_Status,Location_City,Measurement_Start_Timestamp,Activity_Backend_Time,Activity_Client_Time,Activity_Network_Time,SLA_Status,Activity_Name,Application_Name#BUSINESS_ACTIVITIES_RAW(ACTIVITY_BACKEND_TIME,ACTIVITY_CLIENT_TIME,ACTIVITY_DETECTION_STATUS,ACTIVITY_NAME,ACTIVITY_NETWORK_TIME,APPLICATION_NAME,BROWSER,CLIENT_DEVICE_NAME,LOCATION_CITY,MEASUREMENT_START_TIMESTAMP,OS_NAME,SLA_STATUS,USER_DEPARTMENT)",
"document_id": "8cbc18eeabd40e8367ea7d46468cf827",
"value": {
"ACTIVITY_NAME": "Sök kund",
"BROWSER": "Chrome",
"ACTIVITY_NETWORK_TIME": 0.108,
"OS_NAME": "MS Windows 10",
"CLIENT_DEVICE_NAME": "SE83713SX",
"ACTIVITY_BACKEND_TIME": 3.331,
"SLA_STATUS": "Major",
"USER_DEPARTMENT": "Skadeservice SOS",
"LOCATION_CITY": "Not Mapped",
"ACTIVITY_DETECTION_STATUS": "Major",
"MEASUREMENT_START_TIMESTAMP": "2020-08-19T20:48:06+02:00",
"ACTIVITY_CLIENT_TIME": 6.873,
"APPLICATION_NAME": "Y75"
}
},
"_id": "8cbc18eeabd40e8367ea7d46468cf827",
"_score": 3.8933482
},
{
"_index": "business",
"_type": "_doc",
"_source": {
"@timestamp": "2020-08-19T18:49:21.578Z",
"@version": "1",
"@odata.context": "https://replaced text/Detection_Status,Location_City,Measurement_Start_Timestamp,Activity_Backend_Time,Activity_Client_Time,Activity_Network_Time,SLA_Status,Activity_Name,Application_Name#BUSINESS_ACTIVITIES_RAW(ACTIVITY_BACKEND_TIME,ACTIVITY_CLIENT_TIME,ACTIVITY_DETECTION_STATUS,ACTIVITY_NAME,ACTIVITY_NETWORK_TIME,APPLICATION_NAME,BROWSER,CLIENT_DEVICE_NAME,LOCATION_CITY,MEASUREMENT_START_TIMESTAMP,OS_NAME,SLA_STATUS,USER_DEPARTMENT)",
"document_id": "f9182a91354e746c2a3db7b3494b5b7c",
"value": {
"ACTIVITY_NAME": "Klicka på fliken digital akt_Få upp lista",
"BROWSER": "Chrome",
"ACTIVITY_NETWORK_TIME": 0.481,
"OS_NAME": "MS Windows 10",
"CLIENT_DEVICE_NAME": "replaced",
"ACTIVITY_BACKEND_TIME": 4.369,
"SLA_STATUS": "Major",
"USER_DEPARTMENT": "Skadeservice SOS",
"LOCATION_CITY": "Not Mapped",
"ACTIVITY_DETECTION_STATUS": "Major",
"MEASUREMENT_START_TIMESTAMP": "2020-08-19T20:46:08+02:00",
"ACTIVITY_CLIENT_TIME": 123.653,
"APPLICATION_NAME": "Y75"
}
},
"_id": "f9182a91354e746c2a3db7b3494b5b7c",
"_score": 3.8933482
}
],
"total": 3,
"max_score": 3.8933482
},
"took": 860,
"timed_out": false
},
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"business"
],
"rest_total_hits_as_int": true,
"body": {
"query": {
"bool": {
"must": [
{
"match": {
"value.ACTIVITY_DETECTION_STATUS": "Major"
}
}
],
"filter": [
{
"range": {
"value.MEASUREMENT_START_TIMESTAMP": {
"gte": "now-5m/m",
"lte": "now/m"
}
}
}
]
}
}
}
}
}
},
"condition": {
"type": "compare",
"status": "success",
"met": false,
"compare": {
"resolved_values": {
"ctx.payload.hits.total.value": null
}
}
},
"actions": []
},
"messages": []
}