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

Streamline use of IndexClosedException introduced with #6475 #6990

Merged

Conversation

Projects
None yet
5 participants
@javanna
Copy link
Member

javanna commented Jul 23, 2014

Single index operations to use the newly added IndexClosedException introduced with #6475. This way we can also fail faster when we are trying to execute operations on closed indices and their use is not allowed (depending on indices options). Indices blocks are still checked but we can throw error earlier on while resolving indices (MetaData#concreteIndices).

Effectively this change also affects what we return when using one of the following apis: analyze, bulk, index, update, delete, explain, get, multi_get, mlt, term vector, multi_term vector. We now return:

{"error":"IndexClosedException[[test] closed]","status":403}

instead of

{"error":"ClusterBlockException[blocked by: [FORBIDDEN/4/index closed];]","status":403}

Closes #6988

@javanna javanna added the review label Jul 23, 2014

@s1monw

View changes

src/main/java/org/elasticsearch/action/support/IndicesOptions.java Outdated
public static IndicesOptions strictSingleIndexNoExpand() {
return VALUES[FORBID_ALIASES_TO_MULTIPLE_INDICES];
public static IndicesOptions strictSingleIndexNoExpandForbidClosed() {
return VALUES[48];

This comment has been minimized.

Copy link
@s1monw

s1monw Jul 23, 2014

Contributor

why no constant for this?

This comment has been minimized.

Copy link
@javanna

javanna Jul 23, 2014

Author Member

cause this would be the only place where the constant would be used, while the other one was used in other places. Can add it though!

This comment has been minimized.

Copy link
@martijnvg

martijnvg Jul 23, 2014

Member

Make sense to add it just for documentation purposes.

@martijnvg

This comment has been minimized.

Copy link
Member

martijnvg commented Jul 23, 2014

Besides @s1monw comment, LGTM

@javanna

This comment has been minimized.

Copy link
Member Author

javanna commented Jul 23, 2014

Agreed, thanks for the review @mvg and @s1monw , pushed a new commit that adds the missing constants. I think it's ready.

Internal: streamline use of IndexClosedException when executing opera…
…tion on closed indices

Single index operations to use the newly added IndexClosedException introduced with #6475. This way we can also fail faster when we are trying to execute operations on closed indices and their use is not allowed (depending on indices options). Indices blocks are still checked but we can already throw error while resolving indices (MetaData#concreteIndices).

Effectively this change also affects what we return when using one of the following apis: analyze, bulk, index, update, delete, explain, get, multi_get, mlt, term vector, multi_term vector. We now return `{"error":"IndexClosedException[[test] closed]","status":403}` instead of `{"error":"ClusterBlockException[blocked by: [FORBIDDEN/4/index closed];]","status":403}`.

Closes #6988

@javanna javanna merged commit 3e30fa2 into elastic:master Jul 24, 2014

@javanna javanna removed the review label Jul 24, 2014

@javanna javanna self-assigned this Jul 24, 2014

@clintongormley clintongormley changed the title Internal: streamline use of IndexClosedException introduced with #6475 Streamline use of IndexClosedException introduced with #6475 Jun 6, 2015

@lcawl lcawl added :Core/Infra/Core and removed :Exceptions labels Feb 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.