-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise get aliases response #30536
Comments
Pinging @elastic/es-distributed |
I agree, this does require some rethinking. This arose from #25043 which was a solution for #24644. To summarize:
This is how we got to where we are today. That said, this is not at all consistent with our other APIs and I agree we should move it to something like you describe with an error object and a realignment of the status code. |
thanks @jasontedor for the history. One more thing I recently stumbled upon is that we may or may not return indices without matching aliases, depending on whether an alias was provided in the request or not (#27763). I realize there is even more history around this, but I find that a bit confusing, maybe it is a good time to discuss that too if we revise the get aliases response. |
We are working on getting multi index expressions for the GetAlias API ( But, this is touching on a topic being discussed here. And it is stalling #34230 . The problem at hand is that 404s are being returned for wildcards.
This is the present behavior (hard to interpret by the REST client, but nice). It is important, for the following, to mention that this behavior is entirely The present behavior, is troubling when we allow for (wildcard) exclusions.
Sure, the broken behavior can be triggered more simply because
The result is correct but the 404 is wrong. This is something obviously broken, that does not require any debate, The problem is that the fix requires breaking the current good behavior. If a wildcard is followed by an exclusion wildcard there is no way to say if
should both return an empty result, as they do, but without the missing messages, Bottom line, I am proposing to remove reporting aliases as missing altogether. @jasontedor your opinion would be especially valuable. CC @javanna |
I'm removing the |
Pinging @elastic/es-data-management (Team:Data Management) |
I believe this is resolved somewhat by #106514, so I am closing this for now. |
The get aliases API response is somewhat unique. As some other API, it mixes errors with valid aliases returned, which makes it quite hard to reason about. I would like us to review whether we want to make any change.
The usual response is something like the following:
In case a requested index doesn't exist, an error gets returned (status 404):
When some requested aliases are not found though, the response becomes the following if no aliases are found:
and becomes the following when some aliases are not found and some others are found:
The error in the response above should probably be wrapped in another object, and the status returned is
404
although some aliases have been returned. Not sure whether that is intended. This was found as part of #28799 as this kind of responses is quite tricky to parse back when adding support for them to the high-level REST client. It is not clear whether we should throw an exception whenever404
is returned, although in the last case some aliases were found and they would be lost if the client threw an exception. The other problem is that the structure of the "alias not found" error is not compliant to the usual errors that can be parsed back as anElasticsearchException
, which forces us to parse it back as aString
. In fact on the server side it is not an exception, it is just how the response is rendered back at REST.This seems like an example of API that can return "partial results", then the response should probably hold a failure object together with the aliases found?
The text was updated successfully, but these errors were encountered: