Skip to content
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

Inconsistent result from _cat/aliases vs actual state of the indices. #14982

Closed
abrahamduran opened this issue Nov 24, 2015 · 9 comments · Fixed by #15954
Closed

Inconsistent result from _cat/aliases vs actual state of the indices. #14982

abrahamduran opened this issue Nov 24, 2015 · 9 comments · Fixed by #15954
Assignees
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >enhancement good first issue low hanging fruit

Comments

@abrahamduran
Copy link

This was briefly describe in this issue #14818
When I call GET _cat/aliases or GET _aliases I got all the alias associated with an open index, if later I associated the same alias with an closed index, if I try to call the alias I get a index_closed_exception, even when is closed, I understand this, but, is that the desire behavior to the GET _cat/aliases or GET _aliases endpoints (to just show the alias associated with an open index)?

P.S: I said is inconsistent because is not showing all the indices with an alias.

@clintongormley
Copy link
Contributor

This has been made consistent in 2.0. Closing

@abrahamduran
Copy link
Author

You may be wrong, because I'm using ES 2.0 and I still see this issue, consider reopening or letting me know if this was solved on 2.1 exactly, thanks.

@clintongormley
Copy link
Contributor

@AIsaac08 I ran the reproduction shown in #14818 and as @ppf2 said, saw that it had been fixed in 2.0. If you are seeing something different, please provide a recreation that I can run.

@clintongormley
Copy link
Contributor

I've just reread this issue and realised i misunderstood the initial description. Today, the cat-aliases and GET alias/es requests only return open indices, but a search request against an alias will throw a closed-index exception.

I think it was a mistake to only show open indices in the aliases requests. We should show all indices associated with an alias.

There has been a suggestion to remove any aliases automatically when closing an index, but I think this is not the correct behaviour. If a user wants this, then they can simply DELETE {index}/_alias/* before closing the index.

@abrahamduran
Copy link
Author

I have the same thought, if a user wants to remove an alias, the user should explicitly remove the alias. I would prefer that the aliases requests should show all indices with an alias/es associated to them.

@javanna
Copy link
Member

javanna commented Jan 13, 2016

Note that GET alias/_alias will return all indices, including the closed ones, while GET _aliases and GET _cat/aliases will only return the open ones. This behaviour doesn't seem to be configurable, I think we should make this consistent and return all indices in all cases.

@clintongormley
Copy link
Contributor

I agree with making _cat/aliases consistent. There is this issue (#15817) for removing the GET _aliases API.

@javanna
Copy link
Member

javanna commented Jan 13, 2016

I think my comment was a bit premature :) I did some more digging and it turns out that the expand_wildcards option can be used in all cases to control what gets returned. This is because this api allows to specify index names as well, if none are specified that is considered a wildcard expression.

I also stand corrected on what I said above, let me summarize the current behaviour:

GET _alias/alias returns open only indices
GET _alias/alias?expand_wildcards?open,closed returns all indices

Unfortunately the cat api doesn't support expand_wildcards, not sure whether we should expose it or change it to always return all indices.

Also we may want to change the default behaviour of _alias and _aliases endpoint.

@clintongormley
Copy link
Contributor

Hmm OK - thanks for the update @javanna. I think that GET _alias and _cat/aliases should both return closed indices by default (ie expand_wildcards=open,closed). Perhaps _cat/aliases could be expanded to include an indication of whether the index is open or closed, but it probably doesn't need to support the expand_wildcards option.

@javanna javanna self-assigned this Jan 13, 2016
@javanna javanna removed the help wanted adoptme label Jan 13, 2016
javanna added a commit to javanna/elasticsearch that referenced this issue Jan 14, 2016
This change affects get alias, get aliases as well as cat aliases. They all return closed indices too by default. get alias and get aliases also allow to return open indices only through the `expand_wildcards` option (set it to `open`).

Closes elastic#14982
@clintongormley clintongormley added :Data Management/Indices APIs APIs to create and manage indices and templates and removed :Aliases labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >enhancement good first issue low hanging fruit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants