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

Add indices setter to IndicesRequest interface #7734

Closed

Conversation

Projects
None yet
3 participants
@javanna
Copy link
Member

commented Sep 16, 2014

We currently expose generic getters for indices and indicesOptions on the IndicesRequest interface. This commit adds a generic setter as well, which can be used to set the indices to a request. The setter impl throws UnsupportedOperationException if called on internal requests, since it makes sense to eventually replace the indices on external requests only. Also throws exception when the set operation doesn't make sense.

@uboness

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2014

after thinking about it for a while, I think it'd be better to introduce a sub-interface of the IndicesRequest, a la:

public interface IndicesRequest {

    String[] indices();

    IndicesOptions indicesOptions();

    static Replaceable extends IndicesRequest {

        void indices(String... indices);

    }
}

And then for each request choose which one to implement (it'll will avoid all the cases where right now we throw an exception or don't support re-setting the indices)

@javanna javanna force-pushed the javanna:enhancement/indices_request_setter branch Sep 16, 2014

@javanna

This comment has been minimized.

Copy link
Member Author

commented Sep 16, 2014

Agreed @uboness I just pushed a couple of new commits to address your feedback

@javanna javanna added review and removed review labels Sep 18, 2014

@uboness

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2014

LGTM

@javanna javanna removed the review label Sep 18, 2014

@javanna javanna force-pushed the javanna:enhancement/indices_request_setter branch Sep 18, 2014

Internal: add indices setter to IndicesRequest interface
We currently expose generic getters for indices and indicesOptions on the IndicesRequest interface. This commit adds a generic setter as well, which can be used to set the indices to a request. The setter impl throws `UnsupportedOperationException` if called on internal requests. Also throws exception if called on single index operations, since it accepts an array as argument.

@javanna javanna force-pushed the javanna:enhancement/indices_request_setter branch to bb4ff2c Sep 18, 2014

javanna added a commit to javanna/elasticsearch that referenced this pull request Sep 18, 2014

Internal: add indices setter to IndicesRequest interface
We currently expose generic getters for indices and indicesOptions on the IndicesRequest interface. This commit adds a generic setter as well, which can be used to set the indices to a request. The setter impl throws `UnsupportedOperationException` if called on internal requests. Also throws exception if called on single index operations, since it accepts an array as argument.

Closes elastic#7734

javanna added a commit to javanna/elasticsearch that referenced this pull request Sep 18, 2014

Internal: add indices setter to IndicesRequest interface
We currently expose generic getters for indices and indicesOptions on the IndicesRequest interface. This commit adds a generic setter as well, which can be used to set the indices to a request. The setter impl throws `UnsupportedOperationException` if called on internal requests. Also throws exception if called on single index operations, since it accepts an array as argument.

Closes elastic#7734

@javanna javanna closed this in 5f97bcc Sep 18, 2014

@clintongormley clintongormley changed the title Internal: add indices setter to IndicesRequest interface Add indices setter to IndicesRequest interface Jun 7, 2015

mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015

Internal: add indices setter to IndicesRequest interface
We currently expose generic getters for indices and indicesOptions on the IndicesRequest interface. This commit adds a generic setter as well, which can be used to set the indices to a request. The setter impl throws `UnsupportedOperationException` if called on internal requests. Also throws exception if called on single index operations, since it accepts an array as argument.

Closes elastic#7734
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.