diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 431899e37a..caa5f3b041 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -45174,7 +45174,10 @@ "watcher" ], "summary": "Run a watch", - "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\nRefer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "externalDocs": { + "url": "https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/execute-watch" + }, "operationId": "watcher-execute-watch", "parameters": [ { @@ -45200,7 +45203,10 @@ "watcher" ], "summary": "Run a watch", - "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\nRefer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "externalDocs": { + "url": "https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/execute-watch" + }, "operationId": "watcher-execute-watch-1", "parameters": [ { @@ -45228,7 +45234,10 @@ "watcher" ], "summary": "Run a watch", - "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\nRefer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "externalDocs": { + "url": "https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/execute-watch" + }, "operationId": "watcher-execute-watch-2", "parameters": [ { @@ -45251,7 +45260,10 @@ "watcher" ], "summary": "Run a watch", - "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "description": "This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\nRefer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.\n\n## Required authorization\n\n* Cluster privileges: `manage_watcher`\n", + "externalDocs": { + "url": "https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/execute-watch" + }, "operationId": "watcher-execute-watch-3", "parameters": [ { @@ -122001,16 +122013,6 @@ "summary": "Run a watch", "description": "Run `POST _watcher/watch/my_watch/_execute` to run a watch. The input defined in the watch is ignored and the `alternative_input` is used as the payload. The condition as defined by the watch is ignored and is assumed to evaluate to true. The `force_simulate` action forces the simulation of `my-action`. Forcing the simulation means that throttling is ignored and the watch is simulated by Watcher instead of being run normally.\n", "value": "{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}" - }, - "WatcherExecuteRequestExample2": { - "summary": "Run a watch with multiple action modes", - "description": "Run `POST _watcher/watch/my_watch/_execute` and set a different mode for each action.\n", - "value": "{\n \"action_modes\" : {\n \"action1\" : \"force_simulate\",\n \"action2\" : \"skip\"\n }\n}" - }, - "WatcherExecuteRequestExample3": { - "summary": "Run a watch inline", - "description": "Run `POST _watcher/watch/_execute` to run a watch inline. All other settings for this API still apply when inlining a watch. In this example, while the inline watch defines a compare condition, during the execution this condition will be ignored.\n", - "value": "{\n \"watch\" : {\n \"trigger\" : { \"schedule\" : { \"interval\" : \"10s\" } },\n \"input\" : {\n \"search\" : {\n \"request\" : {\n \"indices\" : [ \"logs\" ],\n \"body\" : {\n \"query\" : {\n \"match\" : { \"message\": \"error\" }\n }\n }\n }\n }\n },\n \"condition\" : {\n \"compare\" : { \"ctx.payload.hits.total\" : { \"gt\" : 0 }}\n },\n \"actions\" : {\n \"log_error\" : {\n \"logging\" : {\n \"text\" : \"Found {{ctx.payload.hits.total}} errors in the logs\"\n }\n }\n }\n }\n}" } } } diff --git a/output/schema/schema.json b/output/schema/schema.json index 83033811c9..31dabe842c 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -23759,10 +23759,11 @@ "stability": "stable" } }, - "description": "Run a watch.\nThis API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.", + "description": "Run a watch.\nThis API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\nRefer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.", "docId": "watcher-api-execute-watch", "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-execute-watch", - "extPreviousVersionDocUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-execute-watch.html", + "extDocId": "execute-watch", + "extDocUrl": " https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/execute-watch", "name": "watcher.execute_watch", "privileges": { "cluster": [ @@ -261680,7 +261681,7 @@ } ] }, - "description": "Run a watch.\nThis API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.", + "description": "Run a watch.\nThis API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.\n\nFor testing and debugging purposes, you also have fine-grained control on how the watch runs.\nYou can run the watch without running all of its actions or alternatively by simulating them.\nYou can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.\n\nYou can use the run watch API to run watches that are not yet registered by specifying the watch definition inline.\nThis serves as great tool for testing and debugging your watches prior to adding them to Watcher.\n\nWhen Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches.\nIf your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.\n\nWhen using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.\nRefer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches.", "examples": { "WatcherExecuteRequestExample1": { "alternatives": [ @@ -261713,70 +261714,6 @@ "method_request": "POST _watcher/watch/my_watch/_execute", "summary": "Run a watch", "value": "{\n \"trigger_data\" : { \n \"triggered_time\" : \"now\",\n \"scheduled_time\" : \"now\"\n },\n \"alternative_input\" : { \n \"foo\" : \"bar\"\n },\n \"ignore_condition\" : true, \n \"action_modes\" : {\n \"my-action\" : \"force_simulate\" \n },\n \"record_execution\" : true \n}" - }, - "WatcherExecuteRequestExample2": { - "alternatives": [ - { - "code": "resp = client.watcher.execute_watch(\n id=\"my_watch\",\n action_modes={\n \"action1\": \"force_simulate\",\n \"action2\": \"skip\"\n },\n)", - "language": "Python" - }, - { - "code": "const response = await client.watcher.executeWatch({\n id: \"my_watch\",\n action_modes: {\n action1: \"force_simulate\",\n action2: \"skip\",\n },\n});", - "language": "JavaScript" - }, - { - "code": "response = client.watcher.execute_watch(\n id: \"my_watch\",\n body: {\n \"action_modes\": {\n \"action1\": \"force_simulate\",\n \"action2\": \"skip\"\n }\n }\n)", - "language": "Ruby" - }, - { - "code": "$resp = $client->watcher()->executeWatch([\n \"id\" => \"my_watch\",\n \"body\" => [\n \"action_modes\" => [\n \"action1\" => \"force_simulate\",\n \"action2\" => \"skip\",\n ],\n ],\n]);", - "language": "PHP" - }, - { - "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"action_modes\":{\"action1\":\"force_simulate\",\"action2\":\"skip\"}}' \"$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute\"", - "language": "curl" - }, - { - "code": "client.watcher().executeWatch(e -> e\n .actionModes(Map.of(\"action1\", ActionExecutionMode.ForceSimulate,\"action2\", ActionExecutionMode.Skip))\n .id(\"my_watch\")\n);\n", - "language": "Java" - } - ], - "description": "Run `POST _watcher/watch/my_watch/_execute` and set a different mode for each action.\n", - "method_request": "POST _watcher/watch/my_watch/_execute", - "summary": "Run a watch with multiple action modes", - "value": "{\n \"action_modes\" : {\n \"action1\" : \"force_simulate\",\n \"action2\" : \"skip\"\n }\n}" - }, - "WatcherExecuteRequestExample3": { - "alternatives": [ - { - "code": "resp = client.watcher.execute_watch(\n watch={\n \"trigger\": {\n \"schedule\": {\n \"interval\": \"10s\"\n }\n },\n \"input\": {\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logs\"\n ],\n \"body\": {\n \"query\": {\n \"match\": {\n \"message\": \"error\"\n }\n }\n }\n }\n }\n },\n \"condition\": {\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n \"actions\": {\n \"log_error\": {\n \"logging\": {\n \"text\": \"Found {{ctx.payload.hits.total}} errors in the logs\"\n }\n }\n }\n },\n)", - "language": "Python" - }, - { - "code": "const response = await client.watcher.executeWatch({\n watch: {\n trigger: {\n schedule: {\n interval: \"10s\",\n },\n },\n input: {\n search: {\n request: {\n indices: [\"logs\"],\n body: {\n query: {\n match: {\n message: \"error\",\n },\n },\n },\n },\n },\n },\n condition: {\n compare: {\n \"ctx.payload.hits.total\": {\n gt: 0,\n },\n },\n },\n actions: {\n log_error: {\n logging: {\n text: \"Found {{ctx.payload.hits.total}} errors in the logs\",\n },\n },\n },\n },\n});", - "language": "JavaScript" - }, - { - "code": "response = client.watcher.execute_watch(\n body: {\n \"watch\": {\n \"trigger\": {\n \"schedule\": {\n \"interval\": \"10s\"\n }\n },\n \"input\": {\n \"search\": {\n \"request\": {\n \"indices\": [\n \"logs\"\n ],\n \"body\": {\n \"query\": {\n \"match\": {\n \"message\": \"error\"\n }\n }\n }\n }\n }\n },\n \"condition\": {\n \"compare\": {\n \"ctx.payload.hits.total\": {\n \"gt\": 0\n }\n }\n },\n \"actions\": {\n \"log_error\": {\n \"logging\": {\n \"text\": \"Found {{ctx.payload.hits.total}} errors in the logs\"\n }\n }\n }\n }\n }\n)", - "language": "Ruby" - }, - { - "code": "$resp = $client->watcher()->executeWatch([\n \"body\" => [\n \"watch\" => [\n \"trigger\" => [\n \"schedule\" => [\n \"interval\" => \"10s\",\n ],\n ],\n \"input\" => [\n \"search\" => [\n \"request\" => [\n \"indices\" => array(\n \"logs\",\n ),\n \"body\" => [\n \"query\" => [\n \"match\" => [\n \"message\" => \"error\",\n ],\n ],\n ],\n ],\n ],\n ],\n \"condition\" => [\n \"compare\" => [\n \"ctx.payload.hits.total\" => [\n \"gt\" => 0,\n ],\n ],\n ],\n \"actions\" => [\n \"log_error\" => [\n \"logging\" => [\n \"text\" => \"Found {{ctx.payload.hits.total}} errors in the logs\",\n ],\n ],\n ],\n ],\n ],\n]);", - "language": "PHP" - }, - { - "code": "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d '{\"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\"}}}}}' \"$ELASTICSEARCH_URL/_watcher/watch/_execute\"", - "language": "curl" - }, - { - "code": "client.watcher().executeWatch(e -> e\n .watch(w -> w\n .actions(\"log_error\", a -> a\n .logging(l -> l\n .text(\"Found {{ctx.payload.hits.total}} errors in the logs\")\n )\n )\n .condition(c -> c\n .compare(NamedValue.of(\"ctx.payload.hits.total\",Pair.of(ConditionOp.Gt,FieldValue.of(0))))\n )\n .input(i -> i\n .search(s -> s\n .request(r -> r\n .body(b -> b\n .query(q -> q\n .match(m -> m\n .field(\"message\")\n .query(FieldValue.of(\"error\"))\n )\n )\n )\n .indices(\"logs\")\n )\n )\n )\n .trigger(t -> t\n .schedule(sc -> sc\n .interval(in -> in\n .time(\"10s\")\n )\n )\n )\n )\n);\n", - "language": "Java" - } - ], - "description": "Run `POST _watcher/watch/_execute` to run a watch inline. All other settings for this API still apply when inlining a watch. In this example, while the inline watch defines a compare condition, during the execution this condition will be ignored.\n", - "method_request": "POST _watcher/watch/_execute", - "summary": "Run a watch inline", - "value": "{\n \"watch\" : {\n \"trigger\" : { \"schedule\" : { \"interval\" : \"10s\" } },\n \"input\" : {\n \"search\" : {\n \"request\" : {\n \"indices\" : [ \"logs\" ],\n \"body\" : {\n \"query\" : {\n \"match\" : { \"message\": \"error\" }\n }\n }\n }\n }\n },\n \"condition\" : {\n \"compare\" : { \"ctx.payload.hits.total\" : { \"gt\" : 0 }}\n },\n \"actions\" : {\n \"log_error\" : {\n \"logging\" : {\n \"text\" : \"Found {{ctx.payload.hits.total}} errors in the logs\"\n }\n }\n }\n }\n}" } }, "inherits": { @@ -261818,7 +261755,7 @@ } } ], - "specLocation": "watcher/execute_watch/WatcherExecuteWatchRequest.ts#L28-L105" + "specLocation": "watcher/execute_watch/WatcherExecuteWatchRequest.ts#L28-L107" }, { "kind": "response", diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index d7beebb2be..ddf3f41cce 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -217,6 +217,7 @@ esql-query-params,https://www.elastic.co/docs/explore-analyze/query-filter/langu esql-returning-localized-results,https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql-rest#esql-locale-param, evaluate-dfanalytics,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-evaluate-data-frame,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/evaluate-dfanalytics.html execute-enrich-policy-api,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-enrich-execute-policy,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/execute-enrich-policy-api.html +execute-watch,https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher/execute-watch,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-execute-watch.html expected-reciprocal,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-rank-eval#_expected_reciprocal_rank_err, explain-dfanalytics,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-explain-data-frame-analytics,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/explain-dfanalytics.html fail-processor,https://www.elastic.co/docs/reference/enrich-processor/fail-processor, diff --git a/specification/watcher/execute_watch/WatcherExecuteWatchRequest.ts b/specification/watcher/execute_watch/WatcherExecuteWatchRequest.ts index 749d53fe00..6b26096be8 100644 --- a/specification/watcher/execute_watch/WatcherExecuteWatchRequest.ts +++ b/specification/watcher/execute_watch/WatcherExecuteWatchRequest.ts @@ -40,10 +40,12 @@ import { Watch } from '@watcher/_types/Watch' * If your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch. * * When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch. + * Refer to the external documentation for examples of watch execution requests, including existing, customized, and inline watches. * @rest_spec_name watcher.execute_watch * @availability stack stability=stable * @cluster_privileges manage_watcher * @doc_id watcher-api-execute-watch + * @ext_doc_id execute-watch */ export interface Request extends RequestBase { urls: [ diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml deleted file mode 100644 index e951d831e3..0000000000 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample2.yaml +++ /dev/null @@ -1,64 +0,0 @@ -summary: Run a watch with multiple action modes -method_request: POST _watcher/watch/my_watch/_execute -description: > - Run `POST _watcher/watch/my_watch/_execute` and set a different mode for each action. -# type: request -value: |- - { - "action_modes" : { - "action1" : "force_simulate", - "action2" : "skip" - } - } -alternatives: - - language: Python - code: |- - resp = client.watcher.execute_watch( - id="my_watch", - action_modes={ - "action1": "force_simulate", - "action2": "skip" - }, - ) - - language: JavaScript - code: |- - const response = await client.watcher.executeWatch({ - id: "my_watch", - action_modes: { - action1: "force_simulate", - action2: "skip", - }, - }); - - language: Ruby - code: |- - response = client.watcher.execute_watch( - id: "my_watch", - body: { - "action_modes": { - "action1": "force_simulate", - "action2": "skip" - } - } - ) - - language: PHP - code: |- - $resp = $client->watcher()->executeWatch([ - "id" => "my_watch", - "body" => [ - "action_modes" => [ - "action1" => "force_simulate", - "action2" => "skip", - ], - ], - ]); - - language: curl - code: - 'curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d - ''{"action_modes":{"action1":"force_simulate","action2":"skip"}}'' - "$ELASTICSEARCH_URL/_watcher/watch/my_watch/_execute"' - - language: Java - code: | - client.watcher().executeWatch(e -> e - .actionModes(Map.of("action1", ActionExecutionMode.ForceSimulate,"action2", ActionExecutionMode.Skip)) - .id("my_watch") - ); diff --git a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml b/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml deleted file mode 100644 index 01daac5faa..0000000000 --- a/specification/watcher/execute_watch/examples/request/WatcherExecuteRequestExample3.yaml +++ /dev/null @@ -1,244 +0,0 @@ -summary: Run a watch inline -method_request: POST _watcher/watch/_execute -description: > - Run `POST _watcher/watch/_execute` to run a watch inline. All other settings for this API still apply when inlining a watch. In - this example, while the inline watch defines a compare condition, during the execution this condition will be ignored. -# type: request -value: |- - { - "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" - } - } - } - } - } -alternatives: - - language: Python - code: |- - 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" - } - } - } - }, - ) - - language: JavaScript - code: |- - const response = await client.watcher.executeWatch({ - 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", - }, - }, - }, - }, - }); - - language: Ruby - code: |- - response = client.watcher.execute_watch( - body: { - "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" - } - } - } - } - } - ) - - language: PHP - code: |- - $resp = $client->watcher()->executeWatch([ - "body" => [ - "watch" => [ - "trigger" => [ - "schedule" => [ - "interval" => "10s", - ], - ], - "input" => [ - "search" => [ - "request" => [ - "indices" => array( - "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", - ], - ], - ], - ], - ], - ]); - - language: curl - code: - "curl -X POST -H \"Authorization: ApiKey $ELASTIC_API_KEY\" -H \"Content-Type: application/json\" -d - '{\"watch\":{\"trigger\":{\"schedule\":{\"interval\":\"10s\"}},\"input\":{\"search\":{\"request\":{\"indices\":[\"logs\"],\"b\ - ody\":{\"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\"}}}}}' - \"$ELASTICSEARCH_URL/_watcher/watch/_execute\"" - - language: Java - code: | - client.watcher().executeWatch(e -> e - .watch(w -> w - .actions("log_error", a -> a - .logging(l -> l - .text("Found {{ctx.payload.hits.total}} errors in the logs") - ) - ) - .condition(c -> c - .compare(NamedValue.of("ctx.payload.hits.total",Pair.of(ConditionOp.Gt,FieldValue.of(0)))) - ) - .input(i -> i - .search(s -> s - .request(r -> r - .body(b -> b - .query(q -> q - .match(m -> m - .field("message") - .query(FieldValue.of("error")) - ) - ) - ) - .indices("logs") - ) - ) - ) - .trigger(t -> t - .schedule(sc -> sc - .interval(in -> in - .time("10s") - ) - ) - ) - ) - );