-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Remove support for controversial ignore_unavailable
and allow_no_indices
from indices exists api
#20712
Conversation
"allow_no_indices": { | ||
"type" : "boolean", | ||
"description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should document this a breaking change, just in case users rely on this broken behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it differently. I think it is a bug and we help users that rely on it by fixing it. Otherwise non existing indices cause the api to return true with the "right" indices options, that really makes no sense to rely on I believe :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it makes no sense and I'm happy with this fix. I just think that a short line saying "params X and Y have been removed from the Indices Exists REST API" in changelog is still valuable. But as you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that sounds good. It's just that if we treat it as a breaking change it can't go in a bugfix release, that is what I worry about :)
|
||
public IndicesExistsRequest expandWilcardsClosed(boolean expandWildcardsClosed) { | ||
this.indicesOptions = IndicesOptions.fromOptions(indicesOptions.ignoreUnavailable(), indicesOptions.allowNoIndices(), | ||
indicesOptions.expandWildcardsOpen(), expandWildcardsClosed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could also check that ignore_unavailable
and allow_no_indices
are equals to false
in the validate()
method of the request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? You can't set them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should do this in a test, given that if you can set those options something is broken. I will look into this.
Hum.. to I left some comments |
Right, I corrected that. Let me also ping @elastic/es-clients so they can tell us what they think about the change. |
I chatted with the clients team and they are fine with this change, they also see it as a bugfix which means that it makes sense to backport it. @tlrx I will add some docs around the breaking change when backporting to 5.0 if that's ok with you. |
2abeb1b
to
c953220
Compare
Pardon my ignorance, but is this removing the ability to set |
@epixa yes but only for indices exists api. Do you foresee this as a problem? Would love to hear why this "feature" would be needed for this specific api. |
@epixa I updated the title to better reflect what this change is about. Could you please give me some feedback on whether this change could impact kibana? I thought kibana doesn't use this api at all, but I may be wrong. Thanks! |
@javanna Thanks for the clarification. I don't think we use the Indices Exists api at all, but I just sent a message to the rest of the Kibana team to see if anyone can think of something that I'm missing. Unfortunately it's kind of hard to grep for this sort of thing in Kibana, so I can't determine if we use it statically. |
we don't have many endpoints that support HEAD, maybe grepping HEAD would help, not sure :) |
I think we're good on our end. Thanks for your patience! |
c953220
to
ada5b89
Compare
…ces from indices exists api Exist requests are supposed to never throw an exception, but rather return true or false depending on whether some resource exists or not. Indices exists does that for indices and accepts wildcard expressions too. The way the api works internally is by resolving indices and catching IndexNotFoundException: if an exception is thrown the index does not exist hence it returns false, otherwise it returns true. That works ok only if ignore_unavailable and allow_no_indices indices options are both set to false, meaning that they are strict and any missing index or wildcard expressions that resolves to no indices will lead to an exception that can be thrown and cause false to be returned. Unfortunately the indices options have been configurable up until now for this request, meaning that one can set ignore_unavailable or allow_no_indices to true and have the indices exist request return true for indices that really don't exist, which makes very little sense in the context of this api. This commit removes the indicesOptions setter from the IndicesExistsRequest and makes settable only expandWildcardsOpen and expandWildcardsClosed, hence a subset of the available indices options. This way we can guarantee more consistent behaviour of the indices exists api. We can then remove the ignore_unavailable and allow_no_indices option from indices exists api spec
ada5b89
to
7120587
Compare
@tlrx I got back to this, can you have a final look please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @javanna
@clintongormley I didn't backport this as I saw you have removed 5.0.0 and 5.1.0 labels. Maybe we could consider it as a good enhancement for 5.1.0 though, let me know what you think. |
ignore_unavailable
and allow_no_indices
from indices exists api
Exist requests are supposed to never throw an exception, but rather return
true
orfalse
depending on whether some resource exists or not. Indices exists does that for indices and accepts wildcard expressions. The way the api works internally is by resolving indices like any other api would do and catchingIndexNotFoundException
: if an exception is thrownfalse
is returned, otherwisetrue
. That works only ifignore_unavailable
andallow_no_indices
indices options are both set tofalse
, meaning that they are strict and any missing index or wildcard expression that resolves to no indices leads to an exception that can be thrown and causefalse
to be returned.Unfortunately the indices options have been configurable up until now for the indices exists request, meaning that one can set
ignore_unavailable
orallow_no_indices
totrue
and have the indices exist request returntrue
for indices that really don't exist, which makes very little sense in the context of this api.For instance
curl -iXHEAD localhost:9200/_all?allow_no_indices=true
returns200 OK
against an empty cluster.allow_no_indices
andignore_unavailable
affect badly what this api returns, hence I think they shouldn't be settable in this specific case.This commit removes the
indicesOptions
setter from theIndicesExistsRequest
and makes settable onlyexpandWildcardsOpen
andexpandWildcardsClosed
, hence a subset of the available indices options. This way we can guarantee more consistent behaviour of the indices exists api.ignore_unavailable
will always be set tofalse
, as well asallow_no_indices
.