This change adds a method to WatcherTestUtils to compare two json structures since order is not guaranteed in template parameters.
The Inline template tests in SearchInputTests and SearchTransformTests now use this instead of string comparision.
Original commit: elastic/x-pack-elasticsearch@c433545128
Also the WatcherUtils now always use the search template support from core and never uses ScriptService:
* A template is re-parsed and extended with the watch context variables.
* A normal request body is converted into a search template and watch context variables are used as template params.
Original commit: elastic/x-pack-elasticsearch@16bacaf094
The following node setting will disable watcher (it's enabled by default).
```
watcher.enabled: false
```
Original commit: elastic/x-pack-elasticsearch@1d0541a924
This change adds a force paramter to delete to allow the forcing of a delete to happen ignoring locking.
This means that watch executions may fail when they go to update the watch. Watches executing from the scheduler will fail fast if the watch they are supposed to execute has been removed.
Also move the history store updates outside of the watch locks.
Fixes: elastic/elasticsearch#405
Original commit: elastic/x-pack-elasticsearch@57561b6f85
moved from `text_body` and `html_body` to a more structured `body` object as follows:
```
{
"body" : {
"text" : "the text body",
"html" : "the html body"
}
}
```
`body` can also accpet a string, in which case it will default to the text body of the email:
```
{
"body" : "the text body of the email"
}
```
the above is a syntactic sugar for the following:
```
{
"body" : {
"text" : "the text body of the email"
}
}
```
Original commit: elastic/x-pack-elasticsearch@92406ac2a1
Some of the non java clients don't return the body on an ignore: 404 so we must use catch missing instead.
Original commit: elastic/x-pack-elasticsearch@a10582691c
Bye default, when `attach_data` is set to `true` we attache the watch execution data as a `yaml` file. Now it's possible to configure the format of the file by setting the `attach_data` to an object with a `format` field (can either be set to `yaml` or `json`). Example:
```
"attach_data" : {
"format" : "json"
}
```
Original commit: elastic/x-pack-elasticsearch@5cab59a676
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@4a31114f35
This change changes how the ScheduledTriggerEvent is parsed to parse using DateMath instead of just as a date. This will allow the execute API to use such constructs as
```
POST _watcher/watch/test_watch/_execute
{
"ignore_throttle" : true,
"trigger_event" : {
"schedule" : {
"triggered_time": "now-5h",
"scheduled_time": "now"
}
}
}
```
Fixes: elastic/elasticsearch#374
Original commit: elastic/x-pack-elasticsearch@fa286b217e
This change adds the parameter `master_timeout` to the rest requests that can write to a watch PUT, ACK and DELETE.
Also add support in the rest tests to verify that this is accepted.
Fixes: elastic/elasticsearch#416
Original commit: elastic/x-pack-elasticsearch@4cc1c50f2c
This change renames the hijack test name from "Test Hijack api" to "Test Hijack and Block Direct Access to Internal Indices".
Original commit: elastic/x-pack-elasticsearch@118ac18132
This change changes the manual trigger event to be a wrapper for another `TriggerEvent`.
TriggerEvent is required field for the execute API either via setTriggerEvent on the request or requestBuilder in the java API or `trigger_event` in the REST API
Original commit: elastic/x-pack-elasticsearch@790bdb96a5
This change removes these jars from shading and changes the assemblies file so that they are included as is.
Original commit: elastic/x-pack-elasticsearch@695f5e2b20
Also removed the version checking from the index template support, so that if the settings are changed these settings always get stored in the index template. This means we always put two index templates once watcher started.
And also shutdown watcher after the cluster service has been stopped.
This was done caused deadlock in the integration test framework when we are stopping the test cluster.
If multiple nodes are stopped, a node may briefly try to or run Watcher during the test cluster shutdown.
As part if starting we always put an index template, which will block any other start or stop calls for the WatcherService.
A node was running a put index template call as part of the start procedure while the start framework would stop the node.
The stop call would wait because it doesn't own the lock yet.
The put index template call didn't return, which caused the stop call the keep waiting.
The reason why put index template was hanging is that it failed to return anything while it the node was stopped.
Likely the put index template request got queued up waiting for a change in the cluster state, the cluster service
got stopped and the request got lost, but the watcher start procedure was still waiting.
By stopping Watcher before we stop the cluster service we avoid the scenario described above.
Original commit: elastic/x-pack-elasticsearch@db94b2279e
- wrote an intro where we tell how to get the watcher jar and we tall about the `WatcherClient`
- cleaned up the code snippets
- removed a reference to the `Watch.Parser`
- Also renamed `WatcherStatsResponse#getWatchServiceState` to `watcherStatsResponse.getWatcherState`
Original commit: elastic/x-pack-elasticsearch@814329cba7
An absraction aover XContent byte reference that:
- implements `ToXContent`
- can resolve values given a dot-notation path
- Used in `GetWatchResponse` and `ExecuteWatchResponse`
Also
- Moved `WatchExecutionResult` to the `execution` package
Original commit: elastic/x-pack-elasticsearch@0b41f53f38
- Moved it to its own top level enum `WatcherState`
- Also changed the key holding the current state in the `stats` API to `watcher_state`
Original commit: elastic/x-pack-elasticsearch@2e5ca90f57
Change them to consistently serialize themselves the same way they deserialize themselves.
If the script (or template) is read from a `string` value, it will serialize it self to xcontent as a `string` value as well. Otherwise it will serialize as an object, holding only those fields that where configured in the first place.
Original commit: elastic/x-pack-elasticsearch@52a82e0bbe
This change relocates the shaded jars for guava and owasp under org.elasticsearch.watcher.common and org.elasticsearch.watcher.common.owasp respectively.
Original commit: elastic/x-pack-elasticsearch@0e2d6303e0