-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow partial indices options in watches (#68138)
Partially defined indices options have always been allowed in watches, but the cleanup in #65332 removed this ability and made the definition of indices options within a watch require all fields. This change fixes this by updating the parsing to accept a default indices options and add test coverage for this scenario. Closes #68022 Backport of #68076
- Loading branch information
Showing
5 changed files
with
206 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
...Test/resources/rest-api-spec/test/watcher/put_watch/92_put_watch_with_indices_options.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
--- | ||
setup: | ||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
|
||
--- | ||
"Test put watch with allow no indices": | ||
- skip: | ||
version: "7.10.1 - 7.10.2" | ||
reason: "watch parsing with partial indices options was broken in 7.10.1 and 7.10.2" | ||
- do: | ||
watcher.put_watch: | ||
id: "my_watch_allow_no_indices" | ||
body: > | ||
{ | ||
"trigger": { | ||
"schedule" : { "cron" : "0 0 0 1 * ? 2099" } | ||
}, | ||
"input": { | ||
"search" : { | ||
"request" : { | ||
"indices" : [ "my_test_index" ], | ||
"rest_total_hits_as_int": false, | ||
"body" : { | ||
"query": { | ||
"match_all" : {} | ||
} | ||
}, | ||
"indices_options" : { | ||
"allow_no_indices" : false | ||
} | ||
} | ||
} | ||
}, | ||
"actions": { | ||
"test_index": { | ||
"index": { | ||
"index": "test" | ||
} | ||
} | ||
} | ||
} | ||
- match: { _id: "my_watch_allow_no_indices" } | ||
|
||
- do: | ||
watcher.get_watch: | ||
id: "my_watch_allow_no_indices" | ||
- match: { found : true} | ||
- match: { _id: "my_watch_allow_no_indices" } | ||
- match: { watch.input.search.request.indices_options.allow_no_indices: false } | ||
|
||
--- | ||
"Test put watch with expand wildcards": | ||
- skip: | ||
version: "7.10.1 - 7.99.99" | ||
reason: "watch parsing with partial indices options was broken in 7.10.1" | ||
- do: | ||
watcher.put_watch: | ||
id: "my_watch_expand_wildcards" | ||
body: > | ||
{ | ||
"trigger": { | ||
"schedule" : { "cron" : "0 0 0 1 * ? 2099" } | ||
}, | ||
"input": { | ||
"search" : { | ||
"request" : { | ||
"indices" : [ "my_test_index" ], | ||
"rest_total_hits_as_int": false, | ||
"body" : { | ||
"query": { | ||
"match_all" : {} | ||
} | ||
}, | ||
"indices_options" : { | ||
"expand_wildcards" : [ "open", "hidden" ] | ||
} | ||
} | ||
} | ||
}, | ||
"actions": { | ||
"test_index": { | ||
"index": { | ||
"index": "test" | ||
} | ||
} | ||
} | ||
} | ||
- match: { _id: "my_watch_expand_wildcards" } | ||
|
||
- do: | ||
watcher.get_watch: | ||
id: "my_watch_expand_wildcards" | ||
- match: { found : true} | ||
- match: { _id: "my_watch_expand_wildcards" } | ||
- match: { watch.input.search.request.indices_options.expand_wildcards: [ "open", "hidden" ] } | ||
|
||
--- | ||
"Test put watch with ignore unavailable": | ||
- skip: | ||
version: "7.10.1 - 7.99.99" | ||
reason: "watch parsing with partial indices options was broken in 7.10.1" | ||
- do: | ||
watcher.put_watch: | ||
id: "my_watch_ignore_unavailable" | ||
body: > | ||
{ | ||
"trigger": { | ||
"schedule" : { "cron" : "0 0 0 1 * ? 2099" } | ||
}, | ||
"input": { | ||
"search" : { | ||
"request" : { | ||
"indices" : [ "my_test_index" ], | ||
"rest_total_hits_as_int": false, | ||
"body" : { | ||
"query": { | ||
"match_all" : {} | ||
} | ||
}, | ||
"indices_options" : { | ||
"ignore_unavailable" : false | ||
} | ||
} | ||
} | ||
}, | ||
"actions": { | ||
"test_index": { | ||
"index": { | ||
"index": "test" | ||
} | ||
} | ||
} | ||
} | ||
- match: { _id: "my_watch_ignore_unavailable" } | ||
|
||
- do: | ||
watcher.get_watch: | ||
id: "my_watch_ignore_unavailable" | ||
- match: { found : true} | ||
- match: { _id: "my_watch_ignore_unavailable" } | ||
- match: { watch.input.search.request.indices_options.ignore_unavailable: false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters