HI
i'm trying to set cluster health with condition in script but getting error while i'm execute it.
{
“trigger”: {
“schedule”: {
“interval”: “10s”
}
},
“input”: {
“http”: {
“request”: {
“scheme”: “https”,
“host”: “hostname”,
“port”: XXX,
“method”: “get”,
“path”: “/_cluster/health”,
“params”: {},
“headers”: {},
“auth”: {
“basic”: {
“username”: “XXXXX”,
“password”: “XXXX”
}
}
}
}
},
“condition”: {
“script”:
{
“source”: “return ctx.payload.unassigned_shards > 0 || ctx.payload.status !=green “,
“lang”: “painless”
}
},
“actions”: {
“my-logging-action”: {
“logging”: {
“level”: “info”,
“text”: “Cluster {{ctx.payload.cluster_name}} have not NOT been green for more than {{ctx.metadata.not_green_secs}}s: {{#ctx.payload._value}}{{cluster_id}}-{{cluster_state}}{{/ctx.payload._value}} . & unassigned_shards {{ctx.payload.unassigned_shards}}”
}
}
}
}