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

javanna
Copy link
Member

@javanna javanna 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
Copy link
Contributor

uboness 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 enhancement/indices_request_setter branch from bad8a5d to 0934a94 Compare September 16, 2014 11:22
@javanna
Copy link
Member Author

javanna 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
Copy link
Contributor

uboness commented Sep 18, 2014

LGTM

@javanna javanna removed the review label Sep 18, 2014
@javanna javanna force-pushed the enhancement/indices_request_setter branch from c2a0936 to 7e258e6 Compare September 18, 2014 12:24
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 enhancement/indices_request_setter branch from 7e258e6 to bb4ff2c Compare September 18, 2014 12:24
javanna added a commit to javanna/elasticsearch that referenced this pull request Sep 18, 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. 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
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 added the :Core/Infra/Transport API Transport client API label Mar 19, 2015
@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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants