diff options
author | Jason Tedor <jason@tedor.me> | 2017-06-06 14:37:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-06 14:37:29 -0400 |
commit | e03c4938c5f1176bd4c6b6d2aa1aa1bd48245ace (patch) | |
tree | d3fbe83b9224b035616885b002a5a66df8a12520 /rest-api-spec/src/main | |
parent | 7e60cf3e544f05c89e7a32aa9dc410b95b6bcb24 (diff) |
GET aliases should 404 if aliases are missing
Previously the HEAD and GET aliases endpoints were misaigned in
behavior. The HEAD verb would 404 if any aliases are missing while the
GET verb would not if any aliases existed. When HEAD was aligned with
GET, this broke the previous usage of HEAD to serve as an existence
check for aliases. It is the behavior of GET that is problematic here
though, if any alias is missing the request should 404. This commit
addresses this by modifying the behavior of GET to behave in this
way. This fixes the behavior for HEAD to also 404 when aliases are
missing.
Relates #25043
Diffstat (limited to 'rest-api-spec/src/main')
-rw-r--r-- | rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml | 7 | ||||
-rw-r--r-- | rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_alias/10_basic.yml | 37 |
2 files changed, 37 insertions, 7 deletions
diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml index 87f61efc11..cae598b1b8 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.delete_alias/10_basic.yml @@ -1,5 +1,8 @@ --- "Basic test for delete alias": + - skip: + version: " - 5.99.99" + reason: Previous versions did not 404 on missing aliases - do: indices.create: @@ -25,8 +28,10 @@ name: testali - do: + catch: missing indices.get_alias: index: testind name: testali - - match: { '': {}} + - match: { 'status': 404 } + - match: { 'error': 'alias [testali] missing' } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_alias/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_alias/10_basic.yml index 3cbac46aa5..67e5c38e77 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_alias/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.get_alias/10_basic.yml @@ -78,7 +78,6 @@ setup: --- "Get aliases via /{index}/_alias/prefix*": - - do: indices.get_alias: index: test_index @@ -166,25 +165,51 @@ setup: --- -"Non-existent alias on an existing index returns an empty body": +"Non-existent alias on an existing index returns 404": + - skip: + version: " - 5.99.99" + reason: Previous versions did not 404 on missing aliases - do: + catch: missing indices.get_alias: index: test_index name: non-existent - - match: { '': {}} + - match: { 'status': 404} + - match: { 'error': 'alias [non-existent] missing' } --- -"Existent and non-existent alias returns just the existing": +"Existent and non-existent alias returns 404 and the existing alias": + - skip: + version: " - 5.99.99" + reason: Previous versions did not 404 on missing aliases - do: + catch: missing indices.get_alias: index: test_index name: test_alias,non-existent - - match: {test_index.aliases.test_alias: {}} - - is_false: test_index.aliases.non-existent + - match: { 'status': 404 } + - match: { 'error': 'alias [non-existent] missing' } + - match: { test_index.aliases.test_alias: { } } + +--- +"Existent and non-existent aliases returns 404 and the existing alias": + - skip: + version: " - 5.99.99" + reason: Previous versions did not 404 on missing aliases + + - do: + catch: missing + indices.get_alias: + index: test_index + name: test_alias,non-existent,another-non-existent + + - match: { 'status': 404 } + - match: { 'error': 'aliases [another-non-existent,non-existent] missing' } + - match: { test_index.aliases.test_alias: { } } --- "Getting alias on an non-existent index should return 404": |