// This file is autogenerated, DO NOT EDIT
// rest-api/watcher/execute-watch.asciidoc:333

[source, python]
----
resp = client.watcher.execute_watch(
    watch={
        "trigger": {
            "schedule": {
                "interval": "10s"
            }
        },
        "input": {
            "search": {
                "request": {
                    "indices": [
                        "logs"
                    ],
                    "body": {
                        "query": {
                            "match": {
                                "message": "error"
                            }
                        }
                    }
                }
            }
        },
        "condition": {
            "compare": {
                "ctx.payload.hits.total": {
                    "gt": 0
                }
            }
        },
        "actions": {
            "log_error": {
                "logging": {
                    "text": "Found {{ctx.payload.hits.total}} errors in the logs"
                }
            }
        }
    },
)
print(resp)
----
