Thanks for that, reading through your blog post now. Here is the result from execute API:
#! Deprecation: [types removal] Specifying types in a watcher search request is deprecated.
{
"_id" : "531b40c2-4e64-4a83-9eb4-989cd465f474_d31688ac-7e56-40ab-a5a8-07481c5b318f-2020-03-17T17:40:52.556865Z",
"watch_record" : {
"watch_id" : "531b40c2-4e64-4a83-9eb4-989cd465f474",
"node" : "w88m1bFtSryU64LkC72IdA",
"state" : "execution_not_needed",
"user" : "elastic",
"status" : {
"state" : {
"active" : true,
"timestamp" : "2020-03-09T17:38:15.946Z"
},
"last_checked" : "2020-03-17T17:40:52.556Z",
"actions" : {
"email_me" : {
"ack" : {
"timestamp" : "2020-03-09T17:38:15.946Z",
"state" : "awaits_successful_execution"
}
},
"log" : {
"ack" : {
"timestamp" : "2020-03-09T17:38:15.946Z",
"state" : "awaits_successful_execution"
}
}
},
"execution_state" : "execution_not_needed",
"version" : 2354
},
"trigger_event" : {
"type" : "manual",
"triggered_time" : "2020-03-17T17:40:52.556Z",
"manual" : {
"schedule" : {
"scheduled_time" : "2020-03-17T17:40:52.556Z"
}
}
},
"input" : {
"search" : {
"request" : {
"search_type" : "query_then_fetch",
"indices" : [
"metricbeat-*"
],
"types" : [
"filesystem"
],
"rest_total_hits_as_int" : true,
"body" : {
"aggs" : {
"host" : {
"terms" : {
"field" : "host.hostname",
"order" : {
"disk_usage" : "desc"
}
},
"aggs" : {
"disk_usage" : {
"max" : {
"field" : "system.filesystem.used.pct"
}
}
}
}
},
"query" : {
"bool" : {
"filter" : [
{
"range" : {
"@timestamp" : {
"gte" : "now-{{ctx.metadata.window_period}}"
}
}
},
{
"range" : {
"disk_usage" : {
"gte" : "{{ctx.metadata.threshold}}"
}
}
}
]
}
}
}
}
}
},
"condition" : {
"compare" : {
"ctx.payload.hits.total" : {
"gt" : 0
}
}
},
"metadata" : {
"window_period" : "15m",
"name" : "Disk Used Test - Karn",
"threshold" : 0.8,
"xpack" : {
"type" : "json"
}
},
"result" : {
"execution_time" : "2020-03-17T17:40:52.556Z",
"execution_duration" : 21,
"input" : {
"type" : "search",
"status" : "success",
"payload" : {
"_shards" : {
"total" : 46,
"failed" : 0,
"successful" : 46,
"skipped" : 0
},
"hits" : {
"hits" : [ ],
"total" : 0,
"max_score" : null
},
"took" : 20,
"timed_out" : false,
"aggregations" : {
"host" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [ ]
}
}
},
"search" : {
"request" : {
"search_type" : "query_then_fetch",
"indices" : [
"metricbeat-*"
],
"types" : [
"filesystem"
],
"rest_total_hits_as_int" : true,
"body" : {
"aggs" : {
"host" : {
"terms" : {
"field" : "host.hostname",
"order" : {
"disk_usage" : "desc"
}
},
"aggs" : {
"disk_usage" : {
"max" : {
"field" : "system.filesystem.used.pct"
}
}
}
}
},
"query" : {
"bool" : {
"filter" : [
{
"range" : {
"@timestamp" : {
"gte" : "now-15m"
}
}
},
{
"range" : {
"disk_usage" : {
"gte" : "0.8"
}
}
}
]
}
}
}
}
}
},
"condition" : {
"type" : "compare",
"status" : "success",
"met" : false,
"compare" : {
"resolved_values" : {
"ctx.payload.hits.total" : 0
}
}
},
"actions" : [ ]
},
"messages" : [ ]
}
}