Something like this:
POST _watcher/watch/_execute
{
"watch": {
"trigger": {
"schedule": {
"interval": "1d"
}
},
"input": {
"http": {
"request": {
"scheme": "https",
"host": "mycluster.es.northamerica-northeast1.gcp.elastic-cloud.com",
"port": 9243,
"method": "get",
"path": "_cluster/stats",
"headers": {},
"auth": {
"basic": {
"username": "elastic",
"password": "xxxxxx"
}
}
}
}
},
"condition": {
"script": {
"source": "return true;"
}
},
"actions": {
"displayResults": {
"logging": {
"level": "info",
"text": """
cluster name: {{ctx.payload.cluster_name}}
number_of_hot_data_nodes: {{ctx.payload.nodes.count.data_hot}}
active_primary_shards : {{ctx.payload.indices.shards.primaries}}
"""
}
}
}
}
}
and also see example here for some more advanced calculations, etc.