OpenSearch/qa/smoke-test-watcher-with-groovy/rest-api-spec/test/watcher_groovy/10_basic.yaml

90 lines
3.0 KiB
YAML
Raw Normal View History

This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
---
"Test execute watch api":
- do:
cluster.health:
wait_for_status: green
- do:
watcher.put_watch:
This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
id: "my_exe_watch"
body: >
{
"trigger" : {
"schedule" : { "cron" : "0 0 0 1 * ? 2099" }
This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
},
"input" : {
"search" : {
"request" : {
"indices" : [ "logstash*" ],
"body" : {
"query" : {
"bool": {
"must" : {
"match": {
"response": 404
This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
}
},
"filter": {
"range": {
"@timestamp" : {
"from": "{{ctx.trigger.scheduled_time}}||-5m",
"to": "{{ctx.trigger.triggered_time}}"
}
}
}
}
}
}
}
}
},
"condition" : {
"script" : {
Change Script & Template configuration Scripts and Templates are very much alike. There are only two main differences between them when it comes to watcher: 1. The template doesn't have a language type - it's always mustache. 2. Templates are often used to render xcontent (json/yaml). So there's build in support for content type in it Traditionally, in es core, the configuration of the scripts and templates was always a bit of a mess. There was no consistency between the two and when it comes to the templates configuration, they're even not future proof (future additions to the search requests body can break the templates). After a long discussion, we've decided that we need to change the way users configure templates & scripts in es core... and align the two. These changes will only come in es 2.0. That said, it's important that watcher will be aligned with es core in how templates and scripts are configured and therefore we need to change it for that purpose. Watcher will come with support for the scripts & templates configuration format of es 2.0. We want to future proof the configuration from day one. here are the configuration: Inline: ``` { "inline" : "script here", "lang" : "lang here", "params" : { parameters here } } ``` File: ``` { "file" : "file name here", "lang" : "language here", "params" : { parameters here } } ``` Indexed: ``` { "id" : "template id here", "lang" : "language here", "params" : { parameters here } } ``` For templates it's the same configuration except there is no `lang` field. Also, for templates, there's native support for xcontent: ``` { "inline" : { "key" : "{{param1}}" }, "params" : { "param1" : "value1" } } } ``` Original commit: elastic/x-pack-elasticsearch@4a31114f35b32b1b4c6f4a92c3b144f5ae482d31
2015-05-07 19:50:05 -04:00
"inline" : "ctx.payload.hits.total > 1"
This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
}
},
"actions" : {
Changed `watch_record` xcontent structure - Renamed `watch_execution` to `execution_result` - Renamed `actions_results` to `actions` - Renamed `input_result` to `input` - Renamed `condition_result` to `condition` - Updated the `watch_history.json` template to reflect the changes, also added concrete mappings for action types (such that field that should not be analized will be mapped as `not_analyzed` - Fixed a bug in `WatchUtils.createSearchRequestFromPrototype` where the document types were ignored. Also, changed the `actions` (fka `actions_results`) from an object to an array. the action id is not part of the action objects (indicated by the `id` field). For example: ``` { "actions" : [ { "id" : "my_email", "email" : { ... } } ] } ``` The reason for this change is to make the path to the action fields predictable deterministic. With the object structure, where the actions were keyed by their `id`, the path to the action fields depended on the action id, which is unpredictable and continuously changing from one action to another. This made it impossible to properly analyze the action data using aggregations (as aggs require full path into the aggregated fields). With this change, the mappings of `watch_record` changed as well where the `actions` are not defined as nested type, yet it is still configured to include all the fields in the root object. We do this so in the future, when appropriate support will be added to kibana, it'll be able to apply nested aggregations on the actions, enabling correct/safe multi-dimensional aggregations. In the mean time however, while kibana doesn't support nested aggregations, we still need to have all the fields indexed on the root, so at least a single dimensional aggregations can be safely applied. Also, change the `input` and `condition` objects in the `watch_record` such that their mappings are disabled. The main reason for this is the fact that a lot of the inputs use elements that can be configured in many ways, but the mappings are too strict to accept it. For example, a template can be configured as a `string` or as an `object`. Original commit: elastic/x-pack-elasticsearch@83464a0c719dd805b618f50faeac0edbd3d1bfe4
2015-05-08 16:35:48 -04:00
"email_admin" : {
This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
"email" : {
"to" : "someone@domain.host.com",
"subject" : "404 recently encountered"
}
}
}
}
- match: { _id: "my_exe_watch" }
- do:
watcher.execute_watch:
This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
id: "my_exe_watch"
body: >
{
"trigger_data" : {
"scheduled_time" : "2015-05-05T20:58:02.443Z",
"triggered_time" : "2015-05-05T20:58:02.443Z"
This commit contains a major refactoring to some of the core constructs in watcher. - What used to be the `HistoryService` is not named `ExecutionService`. In fact, it always was an execution context and was simply named wrong and place in the wrog place in the code. - A new `execution` package was created, to contain all execution related contsructs which includes the new `ExecutionService`, `WatchExecutionContext`, `WatchExecutor`, `InternalWatchExecutor`. - The `WatchExecutionContext` role in the execution process was extended to also enable it to "control" the execution. "control" in the sence that it can now provide default results to some of the contructs (for example, it can provide a default input and by that skip the execution of the input). Also, it enables simulating actions (more bellow). - There are two implementations now of the `WatchExecutionContext`. A `TriggeredExecutionContext` which is used when the trigger service triggers the execution of a watch. And `ManualExecutionContext` enabling to manually execute a watch. The latter, can be configured such that different phases in the normal executions of the watch can be skipped. This is great for simulating a watch execution, that is, executing a watch without actually fully executing the actions (e.g. create the emails that the email action would have normally send, but without actually sending it). Both of these new context implementations also sit in the new `execution` package. - With the changes described above, the actions now consult the execution context before actually performing their tasks. If the execution context indicates that the action should run in a "simulated" mode, the action will semi execute and return a `Simulated` result. Each action type defines what is "simulated mode" for it. For example, the email action creates the email and renders all its templats but doesn't actually send it, the returned `Email.Simulated` result will contain the email that would have been sent if it was running under normal conditions (non-simulated mode). The `index` action, doesn't actually indexes anything (just creating the index request that would have been executed), and the `webhook` action only creates the HTTP request but doesn't actually send it. - A new `execute` API was introduced that utilizes all of the above and enables to manually execute registered watches. The API provides all the tools to control what actions are simulated and enables skipping the execution of the watch `input` and `condition`. By default it also skip the recording of the execution in the watch history (though this can be enabled if desired). This API is exposed both by the Java `WatcherClient` and via a dedicated REST endpoint. (documentation around this new API was added as well) Closes elastic/elasticsearch#149 Original commit: elastic/x-pack-elasticsearch@ee8fe0490a093faa7b62a8dcd8534cd2c9d30242
2015-04-08 17:56:03 -04:00
},
Move acking/throttling to the action level Until now, acking and throttling functionality was applied at the watch level. This has major drawbacks in different aspects: - When multiple actions are defined on a watch, acking a watch effectively acks all the actions. This is conceptually wrong. Say you have two actions: `email` and `index`. It's very likely you'd like to ack the email action (to avoid receiving too many emails) but at the same time continue indexing the data in the `index` action. Right now it's not possible. - Different actions types may require different throttling. An `email` action probably needs a longer throttle period compared to an `index` action. Also for different `webhook` actions, the throttling is ultimately determined by the 3rd party system that is called. This commit changes how we do throttling & acking. Moving this functionality to the action level. Now, when acking, each action in the watch will be acked separately. During executiong, each action will determine whether it needs to be throttled or not. The throttler is not associated with the action, not with the watch. The throttle period was enhanced. There is a default throttle period that is configured for watcher as a whole (using the `watcher.execution.default_throttle_period` setting. Next to that, each `watch` can define its own `throttle_period` that can serve as the default throttle period for the actions in the watch. Lastly, each action can have its own throttle period set. Since the throttler is now an action "thing", the `throttle` package was renamed to `throttler` and moved under the `actions` package. Also, `WatchThrottler` was renamed to `ActionThrottler`. With this change, the `Watch Execute API` changed as well. Now, when executing a watch, you can define an execution mode per action. The execution mode offers 4 types of execution: - `execute`: executes the watch normally (actually executing the action and it may be throttled) - `force_execute`: skips/ignores throttling and executes the watch - `simulate`: simulates the watch execution yet it may be throttled - `force_simulate`: skips/ignores throttling and simulates the watch execution As part of this change, the structure of the watch status changed along with the xconent representing the `watch_record`. A new `ActionStatus` was introduced (as part of the `WatchStatus`) and is always set for every action in the watch. This status holds: - the current state of the action (`ackable`, `awaits_successful_execution`, `acked`) - the last execution state (success/failure + reason) - the last successful execution state - the last throttle state (timestamp + reason) Original commit: elastic/x-pack-elasticsearch@32c2985ed8739cb19d436d16092356463f5d1e51
2015-04-27 17:13:50 -04:00
"alternative_input" : {
"foo" : "bar"
},
"ignore_condition" : true,
"action_modes" : {
"_all" : "force_simulate"
},
"record_execution" : true
}
- match: { "watch_record.watch_id": "my_exe_watch" }
- match: { "watch_record.state": "executed" }
De-normalize watch record format Now that the watch record is write once and never read/parsed. We can de-normalize its format (the structure of the `watch_record` document) such it'd be optimal for searching and aggregating. - `execution_result` renamed to `result` (for minimal verbosity) - the structure of `trigger_event` changed to: ``` { "trigger_event" : { "type" : "<trigger_type>", "triggered_time" : "<datetime>", "<trigger_type>" : { // type specific data (optional) } } } ``` - the structure of `input` results changed to: ``` { "result" : { "input" : { "type" : "<input_type>", "payload" : { // the payload }, "<input_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `condition` results changed to: ``` { "result" : { ... "condition" : { "type" : "<condition_type>", "met" : true | false, "<condition_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `transform` results changed to: ``` { "result" : { ... "transform" : { "type" : "<transform_type>", "payload" : { // the transformed payload } "<transform_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `actions` results changed to: ``` { "result" : { ... "actions" : [ { "id" : "<action_id>" "type" : "<action_type>", "status" : "success" | "failure" | "simulated" | "throttled", "reason" : "holds the reasoning if status is either success or throttled", "transform" : { // action level transform result (if applicable)} "<action_type>" : { // custom result fields per type (optional) } }, ... ] } } ``` Original commit: elastic/x-pack-elasticsearch@98466d4b838bb6f0681c95418ea159f2df67186b
2015-06-01 16:41:53 -04:00
- match: { "watch_record.trigger_event.type": "manual" }
- match: { "watch_record.trigger_event.triggered_time": "2015-05-05T20:58:02.443Z" }
- match: { "watch_record.trigger_event.manual.schedule.scheduled_time": "2015-05-05T20:58:02.443Z" }
- match: { "watch_record.result.input.type": "simple" }
- match: { "watch_record.result.input.status": "success" }
De-normalize watch record format Now that the watch record is write once and never read/parsed. We can de-normalize its format (the structure of the `watch_record` document) such it'd be optimal for searching and aggregating. - `execution_result` renamed to `result` (for minimal verbosity) - the structure of `trigger_event` changed to: ``` { "trigger_event" : { "type" : "<trigger_type>", "triggered_time" : "<datetime>", "<trigger_type>" : { // type specific data (optional) } } } ``` - the structure of `input` results changed to: ``` { "result" : { "input" : { "type" : "<input_type>", "payload" : { // the payload }, "<input_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `condition` results changed to: ``` { "result" : { ... "condition" : { "type" : "<condition_type>", "met" : true | false, "<condition_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `transform` results changed to: ``` { "result" : { ... "transform" : { "type" : "<transform_type>", "payload" : { // the transformed payload } "<transform_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `actions` results changed to: ``` { "result" : { ... "actions" : [ { "id" : "<action_id>" "type" : "<action_type>", "status" : "success" | "failure" | "simulated" | "throttled", "reason" : "holds the reasoning if status is either success or throttled", "transform" : { // action level transform result (if applicable)} "<action_type>" : { // custom result fields per type (optional) } }, ... ] } } ``` Original commit: elastic/x-pack-elasticsearch@98466d4b838bb6f0681c95418ea159f2df67186b
2015-06-01 16:41:53 -04:00
- match: { "watch_record.result.input.payload.foo": "bar" }
- match: { "watch_record.result.condition.type": "always" }
- match: { "watch_record.result.condition.status": "success" }
- match: { "watch_record.result.condition.met": true }
De-normalize watch record format Now that the watch record is write once and never read/parsed. We can de-normalize its format (the structure of the `watch_record` document) such it'd be optimal for searching and aggregating. - `execution_result` renamed to `result` (for minimal verbosity) - the structure of `trigger_event` changed to: ``` { "trigger_event" : { "type" : "<trigger_type>", "triggered_time" : "<datetime>", "<trigger_type>" : { // type specific data (optional) } } } ``` - the structure of `input` results changed to: ``` { "result" : { "input" : { "type" : "<input_type>", "payload" : { // the payload }, "<input_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `condition` results changed to: ``` { "result" : { ... "condition" : { "type" : "<condition_type>", "met" : true | false, "<condition_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `transform` results changed to: ``` { "result" : { ... "transform" : { "type" : "<transform_type>", "payload" : { // the transformed payload } "<transform_type>" : { // custom result fields per type (optional) } }, ... } } ``` - the structure of `actions` results changed to: ``` { "result" : { ... "actions" : [ { "id" : "<action_id>" "type" : "<action_type>", "status" : "success" | "failure" | "simulated" | "throttled", "reason" : "holds the reasoning if status is either success or throttled", "transform" : { // action level transform result (if applicable)} "<action_type>" : { // custom result fields per type (optional) } }, ... ] } } ``` Original commit: elastic/x-pack-elasticsearch@98466d4b838bb6f0681c95418ea159f2df67186b
2015-06-01 16:41:53 -04:00
- match: { "watch_record.result.actions.0.id" : "email_admin" }
- match: { "watch_record.result.actions.0.status" : "simulated" }
- match: { "watch_record.result.actions.0.type" : "email" }
- match: { "watch_record.result.actions.0.email.message.subject" : "404 recently encountered" }