Hello,
I'm trying to detect index on read-only with a watcher. I use http input, and I juste want to count the result.
My json watcher :
{
"trigger": {
"schedule": {
"interval": "10m"
}
},
"input": {
"http": {
"request": {
"scheme": "https",
"host": "*****",
"port": 9200,
"method": "get",
"path": "/*/_settings",
"params": {
"filter_path": "*.settings.index.blocks.read_only_allow_delete"
},
"headers": {},
"auth": {
"basic": {
"username": "*****",
"password": "*****"
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gte": 1
}
}
},
"actions": {
"my-logging-action": {
"logging": {
"level": "warn",
"text": "There are {{ctx.payload.hits.total}} read/only index"
}
}
}
}
But in the result, the ctx.payload.hits.total is null (but i see correctly the index on read-only in the payload).
{
"watch_id": "_inlined_",
"node": "DzB7VTgaTGKh0oe8Lxt_oQ",
"state": "execution_not_needed",
"user": "*****",
"status": {
"state": {
"active": true,
"timestamp": "2021-03-25T11:13:06.071Z"
},
"last_checked": "2021-03-25T11:13:06.071Z",
"actions": {
"my-logging-action": {
"ack": {
"timestamp": "2021-03-25T11:13:06.071Z",
"state": "awaits_successful_execution"
}
}
},
"execution_state": "execution_not_needed",
"version": -1
},
"trigger_event": {
"type": "manual",
"triggered_time": "2021-03-25T11:13:06.071Z",
"manual": {
"schedule": {
"scheduled_time": "2021-03-25T11:13:06.071Z"
}
}
},
"input": {
"http": {
"request": {
"scheme": "https",
"host": "*****",
"port": 9200,
"method": "get",
"path": "/*/_settings",
"params": {
"filter_path": "*.settings.index.blocks.read_only_allow_delete"
},
"headers": {},
"auth": {
"basic": {
"username": "*****",
"password": "::es_redacted::"
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gte": 1
}
}
},
"metadata": {
"name": "check-index-settings",
"xpack": {
"type": "json"
}
},
"result": {
"execution_time": "2021-03-25T11:13:06.071Z",
"execution_duration": 29,
"input": {
"type": "http",
"status": "success",
"payload": {
"_headers": {
"content-length": [
"103"
],
"content-type": [
"application/json; charset=UTF-8"
]
},
"_status_code": 200,
"*****_i-000071": {
"settings": {
"index": {
"blocks": {
"read_only_allow_delete": "true"
}
}
}
}
},
"http": {
"request": {
"host": "*****",
"port": 9200,
"scheme": "https",
"method": "get",
"path": "/*/_settings",
"params": {
"filter_path": "*.settings.index.blocks.read_only_allow_delete"
},
"auth": {
"basic": {
"username": "*****",
"password": "::es_redacted::"
}
}
},
"status_code": 200
}
},
"condition": {
"type": "compare",
"status": "success",
"met": false,
"compare": {
"resolved_values": {
"ctx.payload.hits.total": null
}
}
},
"actions": []
},
"messages": []
}
Do you have any idea?