-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[docs] Java high-level REST client : clean up #28703
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -752,17 +752,31 @@ public void testUpdateAliases() throws Exception { | |
| { | ||
| // tag::update-aliases-request | ||
| IndicesAliasesRequest request = new IndicesAliasesRequest(); // <1> | ||
| AliasActions aliasAction = new AliasActions(AliasActions.Type.ADD).index("index1").alias("alias1"); // <2> | ||
| AliasActions aliasAction = | ||
| new AliasActions(AliasActions.Type.ADD) | ||
| .index("index1") | ||
| .alias("alias1"); // <2> | ||
|
||
| request.addAliasAction(aliasAction); // <3> | ||
| // end::update-aliases-request | ||
|
|
||
| // tag::update-aliases-request2 | ||
| AliasActions addIndexAction = new AliasActions(AliasActions.Type.ADD).index("index1").alias("alias1") | ||
| .filter("{\"term\":{\"year\":2016}}"); // <1> | ||
| AliasActions addIndicesAction = new AliasActions(AliasActions.Type.ADD).indices("index1", "index2").alias("alias2") | ||
| .routing("1"); // <2> | ||
| AliasActions removeAction = new AliasActions(AliasActions.Type.REMOVE).index("index3").alias("alias3"); // <3> | ||
| AliasActions removeIndexAction = new AliasActions(AliasActions.Type.REMOVE_INDEX).index("index4"); // <4> | ||
| AliasActions addIndexAction = | ||
| new AliasActions(AliasActions.Type.ADD) | ||
| .index("index1") | ||
| .alias("alias1") | ||
| .filter("{\"term\":{\"year\":2016}}"); // <1> | ||
| AliasActions addIndicesAction = | ||
| new AliasActions(AliasActions.Type.ADD) | ||
| .indices("index1", "index2") | ||
| .alias("alias2") | ||
| .routing("1"); // <2> | ||
| AliasActions removeAction = | ||
| new AliasActions(AliasActions.Type.REMOVE) | ||
| .index("index3") | ||
| .alias("alias3"); // <3> | ||
| AliasActions removeIndexAction = | ||
| new AliasActions(AliasActions.Type.REMOVE_INDEX) | ||
| .index("index4"); // <4> | ||
| // end::update-aliases-request2 | ||
|
|
||
| // tag::update-aliases-request-timeout | ||
|
|
@@ -775,21 +789,24 @@ public void testUpdateAliases() throws Exception { | |
| // end::update-aliases-request-masterTimeout | ||
|
|
||
| // tag::update-aliases-execute | ||
| IndicesAliasesResponse indicesAliasesResponse = client.indices().updateAliases(request); | ||
| IndicesAliasesResponse indicesAliasesResponse = | ||
| client.indices().updateAliases(request); | ||
| // end::update-aliases-execute | ||
|
|
||
| // tag::update-aliases-response | ||
| boolean acknowledged = indicesAliasesResponse.isAcknowledged(); // <1> | ||
| // end::update-aliases-response | ||
| assertTrue(acknowledged); | ||
| } | ||
|
|
||
| { | ||
| IndicesAliasesRequest request = new IndicesAliasesRequest(); // <1> | ||
| AliasActions aliasAction = new AliasActions(AliasActions.Type.ADD).index("index1").alias("async"); // <2> | ||
| IndicesAliasesRequest request = new IndicesAliasesRequest(); | ||
| AliasActions aliasAction = new AliasActions(AliasActions.Type.ADD).index("index1").alias("async"); | ||
| request.addAliasAction(aliasAction); | ||
|
|
||
| // tag::update-aliases-execute-listener | ||
| ActionListener<IndicesAliasesResponse> listener = new ActionListener<IndicesAliasesResponse>() { | ||
| ActionListener<IndicesAliasesResponse> listener = | ||
| new ActionListener<IndicesAliasesResponse>() { | ||
| @Override | ||
| public void onResponse(IndicesAliasesResponse indicesAliasesResponse) { | ||
| // <1> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| [[java-rest-high-update-aliases]] | ||
|
||
| === Update Aliases API | ||
| === Index Aliases API | ||
|
|
||
| [[java-rest-high-update-aliases-request]] | ||
|
||
| ==== Indices Aliases Request | ||
|
|
||
| The Update Aliases API allows aliasing an index with a name, with all APIs | ||
| The Index Aliases API allows aliasing an index with a name, with all APIs | ||
| automatically converting the alias name to the actual index name. | ||
|
|
||
| An `IndicesAliasesRequest` must have at least one `AliasActions`: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why the sections were all called "update-aliases-*" before. The request name (IndicesAliasesRequest) doesn't seem to have changed recently. Maybe it would make sense to update the tags (and the corresponding includes) as well now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is on me, it's a common inconsistency between our Client method names, our request names, and how the API are called in our SPEC. We are now following the name from the SPEC when naming the new methods. But we leave requests unchanged to reduce noise and not impact bw comp too much at this stage. Let's leave the tags as they are?