Fix indices.get_alias error response #2953
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our recordings show two different errors paths. The first one is supported:
{ "api": "indices.get_alias", "file": "/test/free/indices.get_alias/10_basic.yml", "name": "Getting alias on an non-existent index should return 404", "origin": "yaml", "request": { "args": { "index": "non-existent", "name": "foo" } }, "response": { "headers": { "content-encoding": "gzip", "content-length": "164", "content-type": "application/json", "x-elastic-product": "Elasticsearch" }, "payload": { "error": { "index": "non-existent", "index_uuid": "_na_", "reason": "no such index [non-existent]", "resource.id": "non-existent", "resource.type": "index_or_alias", "root_cause": [ { "index": "non-existent", "index_uuid": "_na_", "reason": "no such index [non-existent]", "resource.id": "non-existent", "resource.type": "index_or_alias", "type": "index_not_found_exception" } ], "type": "index_not_found_exception" }, "status": 404 }, "statusCode": 404 } }But the second one was not supported:
{ "api": "indices.get_alias", "file": "/test/free/indices.delete_alias/all_path_options.yml", "name": "check delete with * index", "origin": "yaml", "request": { "args": { "name": "alias1" } }, "response": { "headers": { "content-encoding": "gzip", "content-length": "70", "content-type": "application/json", "x-elastic-product": "Elasticsearch" }, "payload": { "error": "alias [alias1] missing", "status": 404 }, "statusCode": 404 } }Not sure if changing
ErrorResponseBasethis way is OK or not.