Skip to content

Commit

Permalink
Remove _xpack from CCR APIs (#32563)
Browse files Browse the repository at this point in the history
For a new feature like CCR we will go without this extra layer of
indirection. This commit replaces all /_xpack/ccr/_(\S+) endpoints by
/_ccr/$1 endpoints.
  • Loading branch information
jasontedor authored Aug 3, 2018
1 parent 9f96073 commit 2387616
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void testFollowIndex() throws Exception {
createAndFollowIndex("leader_cluster:" + allowedIndex, allowedIndex);
assertBusy(() -> verifyDocuments(client(), allowedIndex, numDocs));
assertThat(countCcrNodeTasks(), equalTo(1));
assertOK(client().performRequest(new Request("POST", "/" + allowedIndex + "/_xpack/ccr/_unfollow")));
assertOK(client().performRequest(new Request("POST", "/" + allowedIndex + "/_ccr/unfollow")));
// Make sure that there are no other ccr relates operations running:
assertBusy(() -> {
Map<String, Object> clusterState = toMap(adminClient().performRequest(new Request("GET", "/_cluster/state")));
Expand All @@ -87,7 +87,7 @@ public void testFollowIndex() throws Exception {

followIndex("leader_cluster:" + allowedIndex, allowedIndex);
assertThat(countCcrNodeTasks(), equalTo(1));
assertOK(client().performRequest(new Request("POST", "/" + allowedIndex + "/_xpack/ccr/_unfollow")));
assertOK(client().performRequest(new Request("POST", "/" + allowedIndex + "/_ccr/unfollow")));
// Make sure that there are no other ccr relates operations running:
assertBusy(() -> {
Map<String, Object> clusterState = toMap(adminClient().performRequest(new Request("GET", "/_cluster/state")));
Expand Down Expand Up @@ -144,13 +144,13 @@ private static void refresh(String index) throws IOException {
}

private static void followIndex(String leaderIndex, String followIndex) throws IOException {
final Request request = new Request("POST", "/" + followIndex + "/_xpack/ccr/_follow");
final Request request = new Request("POST", "/" + followIndex + "/_ccr/follow");
request.setJsonEntity("{\"leader_index\": \"" + leaderIndex + "\", \"idle_shard_retry_delay\": \"10ms\"}");
assertOK(client().performRequest(request));
}

private static void createAndFollowIndex(String leaderIndex, String followIndex) throws IOException {
final Request request = new Request("POST", "/" + followIndex + "/_xpack/ccr/_create_and_follow");
final Request request = new Request("POST", "/" + followIndex + "/_ccr/create_and_follow");
request.setJsonEntity("{\"leader_index\": \"" + leaderIndex + "\", \"idle_shard_retry_delay\": \"10ms\"}");
assertOK(client().performRequest(request));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ private static void refresh(String index) throws IOException {
}

private static void followIndex(String leaderIndex, String followIndex) throws IOException {
final Request request = new Request("POST", "/" + followIndex + "/_xpack/ccr/_follow");
final Request request = new Request("POST", "/" + followIndex + "/_ccr/follow");
request.setJsonEntity("{\"leader_index\": \"" + leaderIndex + "\", \"idle_shard_retry_delay\": \"10ms\"}");
assertOK(client().performRequest(request));
}

private static void createAndFollowIndex(String leaderIndex, String followIndex) throws IOException {
final Request request = new Request("POST", "/" + followIndex + "/_xpack/ccr/_create_and_follow");
final Request request = new Request("POST", "/" + followIndex + "/_ccr/create_and_follow");
request.setJsonEntity("{\"leader_index\": \"" + leaderIndex + "\", \"idle_shard_retry_delay\": \"10ms\"}");
assertOK(client().performRequest(request));
}

private static void unfollowIndex(String followIndex) throws IOException {
assertOK(client().performRequest(new Request("POST", "/" + followIndex + "/_xpack/ccr/_unfollow")));
assertOK(client().performRequest(new Request("POST", "/" + followIndex + "/_ccr/unfollow")));
}

private static void verifyDocuments(String index, int expectedNumDocs) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class RestCreateAndFollowIndexAction extends BaseRestHandler {

public RestCreateAndFollowIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_xpack/ccr/_create_and_follow", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/create_and_follow", this);
}

@Override
public String getName() {
return "xpack_ccr_create_and_follow_index_action";
return "ccr_create_and_follow_index_action";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public class RestFollowIndexAction extends BaseRestHandler {

public RestFollowIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_xpack/ccr/_follow", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/follow", this);
}

@Override
public String getName() {
return "xpack_ccr_follow_index_action";
return "ccr_follow_index_action";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class RestUnfollowIndexAction extends BaseRestHandler {

public RestUnfollowIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_xpack/ccr/_unfollow", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/unfollow", this);
}

@Override
public String getName() {
return "xpack_ccr_unfollow_index_action";
return "ccr_unfollow_index_action";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"xpack.ccr.create_and_follow_index": {
"ccr.create_and_follow_index": {
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current",
"methods": [ "POST" ],
"url": {
"path": "/{index}/_xpack/ccr/_create_and_follow",
"paths": [ "/{index}/_xpack/ccr/_create_and_follow" ],
"path": "/{index}/_ccr/create_and_follow",
"paths": [ "/{index}/_ccr/create_and_follow" ],
"parts": {
"index": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"xpack.ccr.follow_index": {
"ccr.follow_index": {
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current",
"methods": [ "POST" ],
"url": {
"path": "/{index}/_xpack/ccr/_follow",
"paths": [ "/{index}/_xpack/ccr/_follow" ],
"path": "/{index}/_ccr/follow",
"paths": [ "/{index}/_ccr/follow" ],
"parts": {
"index": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"xpack.ccr.unfollow_index": {
"ccr.unfollow_index": {
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current",
"methods": [ "POST" ],
"url": {
"path": "/{index}/_xpack/ccr/_unfollow",
"paths": [ "/{index}/_xpack/ccr/_unfollow" ],
"path": "/{index}/_ccr/unfollow",
"paths": [ "/{index}/_ccr/unfollow" ],
"parts": {
"index": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- is_true: acknowledged

- do:
xpack.ccr.create_and_follow_index:
ccr.create_and_follow_index:
index: bar
body:
leader_index: foo
Expand All @@ -25,18 +25,18 @@
- is_true: index_following_started

- do:
xpack.ccr.unfollow_index:
ccr.unfollow_index:
index: bar
- is_true: acknowledged

- do:
xpack.ccr.follow_index:
ccr.follow_index:
index: bar
body:
leader_index: foo
- is_true: acknowledged

- do:
xpack.ccr.unfollow_index:
ccr.unfollow_index:
index: bar
- is_true: acknowledged

0 comments on commit 2387616

Please sign in to comment.