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 Close Index API to the high level REST client #27734

Merged
merged 9 commits into from
Jan 17, 2018

Conversation

olcbean
Copy link
Contributor

@olcbean olcbean commented Dec 8, 2017

Add _close to the high level REST client

Relates to #27205

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one small comment on testing, LGTM otherwise, thanks a lot @olcbean as usual, good stuff!

indices[i] = "index-" + randomAlphaOfLengthBetween(2, 5);
}
deleteIndexRequest.indices(indices);
String[] indices = IndicesClientIT.randomIndicesNames(0, 5);
Copy link
Member

@javanna javanna Dec 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too happy with sharing this method between an integration test and this unit test. Furthermore, I have second thoughts on the randomization of indices in the open close index test. Maybe we should rather have randomization only here, as in a unit test it fits better, while in an integration test it can cause noise as there are many more moving parts.

* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html">
* Close Index API on elastic.co</a>
*/
public CloseIndexResponse closeIndex(CloseIndexRequest closeIndexRequest, Header... headers) throws IOException {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javanna what about removing the *Index suffix from the method names in the IndicesClient - similar to what is done in the IndicesAdminClient, where one simply calls create to trigger a create index request or close to trigger a close index request ? Then the user will simply call client.indices().close() instead of client.indices().closeIndex().

Copy link
Member

@javanna javanna Dec 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a very good point @olcbean. I missed this subtle difference. Let's do it in a followup PR please.

@javanna
Copy link
Member

javanna commented Dec 11, 2017

test this please

@javanna
Copy link
Member

javanna commented Dec 11, 2017

one thing @olcbean I think we need add docs for the new method, do you have time to do it?

@olcbean
Copy link
Contributor Author

olcbean commented Dec 11, 2017

@javanna can I also add docs for open index here, or better a separate PR ?

include::scroll.asciidoc[]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need these extra empty lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really... A good example is
https://github.com/elastic/elasticsearch/blob/master/docs/java-api/admin/indices/index.asciidoc ( where both approaches are present ;) )
Basically if there is no extra new line, the two terms are displayed on the same line.

--------------------------------------------------
include-tagged::{doc-tests}/IndicesClientDocumentationIT.java[close-index-request-masterTimeout]
--------------------------------------------------
<1> Timeout to connect to the master node as a `TimeValue`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also mention indices options in the docs please?

@javanna
Copy link
Member

javanna commented Dec 11, 2017

@olcbean oh oh did I merge that other PR without docs? :) please if you could add them as part of this PR it would be great. Thank you!

--------------------------------------------------
<1> Indicates whether all of the nodes have acknowledged the request
<2> Indicates whether the requisite number of shard copies were started for
each shard in the index before timing out
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have these errors when I build the docs:

asciidoc: WARNING: open_index.asciidoc: line 38: no callouts refer to list item 1
asciidoc: WARNING: open_index.asciidoc: line 40: no callouts refer to list item 2
asciidoc: WARNING: open_index.asciidoc: line 80: no callouts refer to list item 2

@elastic elastic deleted a comment from elasticmachine Jan 16, 2018
@javanna
Copy link
Member

javanna commented Jan 16, 2018

test this please

@javanna
Copy link
Member

javanna commented Jan 16, 2018

hi @olcbean sorry about the delay, I just merged master in and took the liberty to push those changes to your remote. I also triggered a new build, I will merge this as soon as the build is green.

@javanna javanna merged commit b98514c into elastic:master Jan 17, 2018
javanna pushed a commit that referenced this pull request Jan 17, 2018
Add support for _close endpoint to the high level REST client

Relates to #27205
@javanna
Copy link
Member

javanna commented Jan 17, 2018

thanks once again @olcbean , onto your next PR ;)

@olcbean
Copy link
Contributor Author

olcbean commented Jan 17, 2018

@javanna thanks! As this is now merged I will go ahead and clean up the API : remove the Index suffixes (#27734 (comment)). AFAICS this was the last PRs using the Index suffix, so it should be pretty straight forward.

As the high level client has been released, I guess the deleteIndex should be deprecated first?

@javanna
Copy link
Member

javanna commented Jan 17, 2018

@olcbean I already took care of the suffix, see #28263 .

@olcbean
Copy link
Contributor Author

olcbean commented Jan 18, 2018

@javanna Grumble. I was told to wait for this PR to be merged before proceeding to the clean up as to keep the PRs simple, consistent with the code base till then and as self contained as possible.

I must admit that the dynamics around most of my recent PRs is rather discouraging. There were multiple occurrences in which I was told to wait and in the mean time a core member would sweep in and implement the exact agreed upon changes.

I still find the project interesting, and would like to continue contributing further in my spare time ( perhaps even more involved changesets - #27163 (comment) is still waiting for a green light ). But the current trend seems to limit contributions to the most inconsequential ones and outright prevents non-members working incrementally within the same area.

Is there a way to clarify the policy in regards to my observations above: in other words which kinds of contributions are actually welcome, and which kinds are considered too much of an overhead?

@javanna
Copy link
Member

javanna commented Jan 18, 2018

I am really sorry @olcbean . My bad, I genuinely thought that taking care of the rename would be a relief to you, also I needed to look into it myself as I was not sure about potential deprecation, backporting, and we needed to discuss that internally.

I am not sure when something like this happened before, if it did that is definitely annoying and not fair to you. I will pay more attention in the future to these aspects.

I can imagine that some frustration comes from a delay in merging some of your PRs recently also, for that I apologize once again, we will try to do better there.

It is indeed a challenge to have external contributors work on big changes, especially when we don't have clear agreement internally on how to move forward. I wouldn't translate that though to saying that this prevents external contributors to work incrementally within the same area, I am actually very happy with your progress and your various PRs that improve step by step the client as well as other areas of Elasticsearch. It is good to know that you would like to work on something more involving, I/we will keep that in mind and ping you whenever something appealing shows up (cc @clintongormley .

As for your request for some policy, we don't have such a policy and we tend to handle that case by case. In a lot of cases we worry a lot about potentially having external contributors spend a lot of time on something that is controversial and that we are not sure will be merged (that is the case for #27163 (comment)). In general, on big changes it is always good to ping us before starting so we can advice on how to move forward etc.

Thanks for raising your concerns, that helps making things better on our end!

@olcbean
Copy link
Contributor Author

olcbean commented Jan 18, 2018

Thank you @javanna for the detailed response. I can see how much of this was unintentional. I hope my venting wasn't taken the wrong way ;)

I want to address a specific point towards the end: I certainly did not mean to imply that the project needs a complex written down policy regarding contributions - that'd be rather unpleasant for everyone involved. Having awareness within the team that sometimes things go sideways is more than enough.

Thanks!

@javanna
Copy link
Member

javanna commented Jan 19, 2018

No worries @olcbean nothing was taken the wrong way, we appreciate you reaching out with your concerns.

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.

4 participants