mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-23 21:38:15 +00:00
Watcher: Fix ack watch documentation (elastic/x-pack-elasticsearch#1695)
The ack watch documentation was exlcuded from the tests and thus contained wrong information. This commit cleans it up. relates elastic/x-pack-elasticsearch#1642 Original commit: elastic/x-pack-elasticsearch@81d69174df
This commit is contained in:
parent
62ee1bc635
commit
b86c2e6e18
@ -158,7 +158,6 @@ buildRestTests.docs = fileTree(projectDir) {
|
|||||||
// That is where the snippets go, not where they come from!
|
// That is where the snippets go, not where they come from!
|
||||||
exclude 'build'
|
exclude 'build'
|
||||||
// These file simply doesn't pass yet. We should figure out how to fix them.
|
// These file simply doesn't pass yet. We should figure out how to fix them.
|
||||||
exclude 'en/rest-api/watcher/ack-watch.asciidoc'
|
|
||||||
exclude 'en/watcher/reference/actions.asciidoc'
|
exclude 'en/watcher/reference/actions.asciidoc'
|
||||||
exclude 'en/rest-api/graph/explore.asciidoc'
|
exclude 'en/rest-api/graph/explore.asciidoc'
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,13 @@ check the status:
|
|||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
POST _xpack/watcher/watch/my_watch/_execute
|
POST _xpack/watcher/watch/my_watch/_execute
|
||||||
|
{
|
||||||
|
"record_execution" : true
|
||||||
|
}
|
||||||
|
|
||||||
GET _xpack/watcher/watch/my_watch
|
GET _xpack/watcher/watch/my_watch
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
// TEST[continued]
|
// TEST[continued]
|
||||||
|
|
||||||
and the action is now in `ackable` state:
|
and the action is now in `ackable` state:
|
||||||
@ -96,23 +101,36 @@ and the action is now in `ackable` state:
|
|||||||
"found": true,
|
"found": true,
|
||||||
"_id": "my_watch",
|
"_id": "my_watch",
|
||||||
"status": {
|
"status": {
|
||||||
"version": 1,
|
"version": 2,
|
||||||
"actions": {
|
"actions": {
|
||||||
"test_index": {
|
"test_index": {
|
||||||
"ack": {
|
"ack": {
|
||||||
"timestamp": "2015-05-26T18:04:27.723Z",
|
"timestamp": "2015-05-26T18:04:27.723Z",
|
||||||
"state": "ackable"
|
"state": "ackable"
|
||||||
|
},
|
||||||
|
"last_execution" : {
|
||||||
|
"timestamp": "2015-05-25T18:04:27.723Z",
|
||||||
|
"successful": true
|
||||||
|
},
|
||||||
|
"last_successful_execution" : {
|
||||||
|
"timestamp": "2015-05-25T18:04:27.723Z",
|
||||||
|
"successful": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"state": ...
|
"state": ...,
|
||||||
|
"last_checked": ...,
|
||||||
|
"last_met_condition": ...
|
||||||
},
|
},
|
||||||
"watch": ...
|
"watch": ...
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// TESTRESPONSE[s/"state": \.\.\./"state": "$body.status.state"/]
|
// TESTRESPONSE[s/"state": \.\.\./"state": "$body.status.state"/]
|
||||||
// TESTRESPONSE[s/"watch": \.\.\./"watch": "$body.watch"/]
|
// TESTRESPONSE[s/"watch": \.\.\./"watch": "$body.watch"/]
|
||||||
|
// TESTRESPONSE[s/"last_checked": \.\.\./"last_checked": "$body.status.last_checked"/]
|
||||||
|
// TESTRESPONSE[s/"last_met_condition": \.\.\./"last_met_condition": "$body.status.last_met_condition"/]
|
||||||
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:04:27.723Z"/"timestamp": "$body.status.actions.test_index.ack.timestamp"/]
|
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:04:27.723Z"/"timestamp": "$body.status.actions.test_index.ack.timestamp"/]
|
||||||
|
// TESTRESPONSE[s/"timestamp": "2015-05-25T18:04:27.723Z"/"timestamp": "$body.status.actions.test_index.last_execution.timestamp"/]
|
||||||
|
|
||||||
Now we can acknowledge it:
|
Now we can acknowledge it:
|
||||||
|
|
||||||
@ -122,6 +140,7 @@ PUT _xpack/watcher/watch/my_watch/_ack/test_index
|
|||||||
GET _xpack/watcher/watch/my_watch
|
GET _xpack/watcher/watch/my_watch
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
|
// TEST[continued]
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
@ -129,23 +148,36 @@ GET _xpack/watcher/watch/my_watch
|
|||||||
"found": true,
|
"found": true,
|
||||||
"_id": "my_watch",
|
"_id": "my_watch",
|
||||||
"status": {
|
"status": {
|
||||||
"version": 1,
|
"version": 3,
|
||||||
"actions": {
|
"actions": {
|
||||||
"test_index": {
|
"test_index": {
|
||||||
"ack": {
|
"ack": {
|
||||||
"timestamp": "2015-05-26T18:04:27.723Z",
|
"timestamp": "2015-05-26T18:04:27.723Z",
|
||||||
"state": "acknowledged"
|
"state": "acked"
|
||||||
|
},
|
||||||
|
"last_execution" : {
|
||||||
|
"timestamp": "2015-05-25T18:04:27.723Z",
|
||||||
|
"successful": true
|
||||||
|
},
|
||||||
|
"last_successful_execution" : {
|
||||||
|
"timestamp": "2015-05-25T18:04:27.723Z",
|
||||||
|
"successful": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"state": ...
|
"state": ...,
|
||||||
|
"last_checked": ...,
|
||||||
|
"last_met_condition": ...
|
||||||
},
|
},
|
||||||
"watch": ...
|
"watch": ...
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// TESTRESPONSE[s/"state": \.\.\./"state": "$body.status.state"/]
|
// TESTRESPONSE[s/"state": \.\.\./"state": "$body.status.state"/]
|
||||||
// TESTRESPONSE[s/"watch": \.\.\./"watch": "$body.watch"/]
|
// TESTRESPONSE[s/"watch": \.\.\./"watch": "$body.watch"/]
|
||||||
|
// TESTRESPONSE[s/"last_checked": \.\.\./"last_checked": "$body.status.last_checked"/]
|
||||||
|
// TESTRESPONSE[s/"last_met_condition": \.\.\./"last_met_condition": "$body.status.last_met_condition"/]
|
||||||
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:04:27.723Z"/"timestamp": "$body.status.actions.test_index.ack.timestamp"/]
|
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:04:27.723Z"/"timestamp": "$body.status.actions.test_index.ack.timestamp"/]
|
||||||
|
// TESTRESPONSE[s/"timestamp": "2015-05-25T18:04:27.723Z"/"timestamp": "$body.status.actions.test_index.last_execution.timestamp"/]
|
||||||
|
|
||||||
Acknowledging an action throttles further executions of that action until its
|
Acknowledging an action throttles further executions of that action until its
|
||||||
`ack.state` is reset to `awaits_successful_execution`. This happens when the
|
`ack.state` is reset to `awaits_successful_execution`. This happens when the
|
||||||
@ -167,58 +199,46 @@ parameter:
|
|||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
POST _xpack/watcher/watch/my_watch/_ack
|
POST _xpack/watcher/watch/my_watch/_ack
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// TEST[s/^/POST _xpack\/watcher\/watch\/my_watch\/_execute\n{ "record_execution" : true }\n/]
|
||||||
// CONSOLE
|
// CONSOLE
|
||||||
|
|
||||||
[float]
|
|
||||||
==== Timeouts
|
|
||||||
|
|
||||||
If you acknowledge a watch while it is executing, the request blocks and waits
|
The response looks like a get watch response, but only contains the status:
|
||||||
for the watch execution to finish. For some watches, this can take a significant
|
|
||||||
amount of time. By default, the acknowledge action has a timeout of 10 seconds.
|
|
||||||
You can change the timeout setting by specifying the `master_timeout` parameter.
|
|
||||||
|
|
||||||
The following snippet shows how to change the default timeout of the acknowledge
|
|
||||||
action to 30 seconds:
|
|
||||||
|
|
||||||
[source,js]
|
|
||||||
--------------------------------------------------
|
|
||||||
POST _xpack/watcher/watch/my_watch/_ack?master_timeout=30s
|
|
||||||
--------------------------------------------------
|
|
||||||
// CONSOLE
|
|
||||||
|
|
||||||
[float]
|
|
||||||
==== Response format
|
|
||||||
[source,js]
|
|
||||||
|
|
||||||
The response format looks like:
|
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
{
|
{
|
||||||
"status": {
|
"status": {
|
||||||
"last_checked": "2015-05-26T18:21:08.630Z",
|
"state": {
|
||||||
"last_met_condition": "2015-05-26T18:21:08.630Z",
|
"active": true,
|
||||||
"actions": {
|
"timestamp": "2015-05-26T18:04:27.723Z"
|
||||||
"my-action": {
|
},
|
||||||
"ack_status": {
|
"last_checked": "2015-05-26T18:04:27.753Z",
|
||||||
"timestamp": "2015-05-26T18:21:09.982Z",
|
"last_met_condition": "2015-05-26T18:04:27.763Z",
|
||||||
"state": "acked"
|
"actions": {
|
||||||
},
|
"test_index": {
|
||||||
"last_execution": {
|
"ack" : {
|
||||||
"timestamp": "2015-05-26T18:21:04.106Z",
|
"timestamp": "2015-05-26T18:04:27.713Z",
|
||||||
"successful": true
|
"state": "acked"
|
||||||
},
|
},
|
||||||
"last_successful_execution": {
|
"last_execution" : {
|
||||||
"timestamp": "2015-05-26T18:21:04.106Z",
|
"timestamp": "2015-05-25T18:04:27.733Z",
|
||||||
"successful": true
|
"successful": true
|
||||||
},
|
},
|
||||||
"last_throttle": {
|
"last_successful_execution" : {
|
||||||
"timestamp": "2015-05-26T18:21:08.630Z",
|
"timestamp": "2015-05-25T18:04:27.773Z",
|
||||||
"reason": "throttling interval is set to [5 seconds] but time elapsed since last execution is [4 seconds and 530 milliseconds]"
|
"successful": true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"version": 2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// TESTRESPONSE
|
// TESTRESPONSE[s/"last_checked": "2015-05-26T18:04:27.753Z"/"last_checked": "$body.status.last_checked"/]
|
||||||
|
// TESTRESPONSE[s/"last_met_condition": "2015-05-26T18:04:27.763Z"/"last_met_condition": "$body.status.last_met_condition"/]
|
||||||
|
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:04:27.723Z"/"timestamp": "$body.status.state.timestamp"/]
|
||||||
|
// TESTRESPONSE[s/"timestamp": "2015-05-26T18:04:27.713Z"/"timestamp": "$body.status.actions.test_index.ack.timestamp"/]
|
||||||
|
// TESTRESPONSE[s/"timestamp": "2015-05-25T18:04:27.733Z"/"timestamp": "$body.status.actions.test_index.last_execution.timestamp"/]
|
||||||
|
// TESTRESPONSE[s/"timestamp": "2015-05-25T18:04:27.773Z"/"timestamp": "$body.status.actions.test_index.last_successful_execution.timestamp"/]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user