Skip to content

Commit 2387616

Browse files
authored
Remove _xpack from CCR APIs (#32563)
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.
1 parent 9f96073 commit 2387616

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

x-pack/plugin/ccr/qa/multi-cluster-with-security/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexSecurityIT.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void testFollowIndex() throws Exception {
7676
createAndFollowIndex("leader_cluster:" + allowedIndex, allowedIndex);
7777
assertBusy(() -> verifyDocuments(client(), allowedIndex, numDocs));
7878
assertThat(countCcrNodeTasks(), equalTo(1));
79-
assertOK(client().performRequest(new Request("POST", "/" + allowedIndex + "/_xpack/ccr/_unfollow")));
79+
assertOK(client().performRequest(new Request("POST", "/" + allowedIndex + "/_ccr/unfollow")));
8080
// Make sure that there are no other ccr relates operations running:
8181
assertBusy(() -> {
8282
Map<String, Object> clusterState = toMap(adminClient().performRequest(new Request("GET", "/_cluster/state")));
@@ -87,7 +87,7 @@ public void testFollowIndex() throws Exception {
8787

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

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

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

x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,19 @@ private static void refresh(String index) throws IOException {
9494
}
9595

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

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

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

112112
private static void verifyDocuments(String index, int expectedNumDocs) throws IOException {

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCreateAndFollowIndexAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public class RestCreateAndFollowIndexAction extends BaseRestHandler {
2121

2222
public RestCreateAndFollowIndexAction(Settings settings, RestController controller) {
2323
super(settings);
24-
controller.registerHandler(RestRequest.Method.POST, "/{index}/_xpack/ccr/_create_and_follow", this);
24+
controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/create_and_follow", this);
2525
}
2626

2727
@Override
2828
public String getName() {
29-
return "xpack_ccr_create_and_follow_index_action";
29+
return "ccr_create_and_follow_index_action";
3030
}
3131

3232
@Override

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowIndexAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public class RestFollowIndexAction extends BaseRestHandler {
2222

2323
public RestFollowIndexAction(Settings settings, RestController controller) {
2424
super(settings);
25-
controller.registerHandler(RestRequest.Method.POST, "/{index}/_xpack/ccr/_follow", this);
25+
controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/follow", this);
2626
}
2727

2828
@Override
2929
public String getName() {
30-
return "xpack_ccr_follow_index_action";
30+
return "ccr_follow_index_action";
3131
}
3232

3333
@Override

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestUnfollowIndexAction.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public class RestUnfollowIndexAction extends BaseRestHandler {
2121

2222
public RestUnfollowIndexAction(Settings settings, RestController controller) {
2323
super(settings);
24-
controller.registerHandler(RestRequest.Method.POST, "/{index}/_xpack/ccr/_unfollow", this);
24+
controller.registerHandler(RestRequest.Method.POST, "/{index}/_ccr/unfollow", this);
2525
}
2626

2727
@Override
2828
public String getName() {
29-
return "xpack_ccr_unfollow_index_action";
29+
return "ccr_unfollow_index_action";
3030
}
3131

3232
@Override

x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ccr.create_and_follow_index.json x-pack/plugin/src/test/resources/rest-api-spec/api/ccr.create_and_follow_index.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"xpack.ccr.create_and_follow_index": {
2+
"ccr.create_and_follow_index": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current",
44
"methods": [ "POST" ],
55
"url": {
6-
"path": "/{index}/_xpack/ccr/_create_and_follow",
7-
"paths": [ "/{index}/_xpack/ccr/_create_and_follow" ],
6+
"path": "/{index}/_ccr/create_and_follow",
7+
"paths": [ "/{index}/_ccr/create_and_follow" ],
88
"parts": {
99
"index": {
1010
"type": "string",

x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ccr.follow_index.json x-pack/plugin/src/test/resources/rest-api-spec/api/ccr.follow_index.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"xpack.ccr.follow_index": {
2+
"ccr.follow_index": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current",
44
"methods": [ "POST" ],
55
"url": {
6-
"path": "/{index}/_xpack/ccr/_follow",
7-
"paths": [ "/{index}/_xpack/ccr/_follow" ],
6+
"path": "/{index}/_ccr/follow",
7+
"paths": [ "/{index}/_ccr/follow" ],
88
"parts": {
99
"index": {
1010
"type": "string",

x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ccr.unfollow_index.json x-pack/plugin/src/test/resources/rest-api-spec/api/ccr.unfollow_index.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"xpack.ccr.unfollow_index": {
2+
"ccr.unfollow_index": {
33
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current",
44
"methods": [ "POST" ],
55
"url": {
6-
"path": "/{index}/_xpack/ccr/_unfollow",
7-
"paths": [ "/{index}/_xpack/ccr/_unfollow" ],
6+
"path": "/{index}/_ccr/unfollow",
7+
"paths": [ "/{index}/_ccr/unfollow" ],
88
"parts": {
99
"index": {
1010
"type": "string",

x-pack/plugin/src/test/resources/rest-api-spec/test/ccr/follow_and_unfollow.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- is_true: acknowledged
1717

1818
- do:
19-
xpack.ccr.create_and_follow_index:
19+
ccr.create_and_follow_index:
2020
index: bar
2121
body:
2222
leader_index: foo
@@ -25,18 +25,18 @@
2525
- is_true: index_following_started
2626

2727
- do:
28-
xpack.ccr.unfollow_index:
28+
ccr.unfollow_index:
2929
index: bar
3030
- is_true: acknowledged
3131

3232
- do:
33-
xpack.ccr.follow_index:
33+
ccr.follow_index:
3434
index: bar
3535
body:
3636
leader_index: foo
3737
- is_true: acknowledged
3838

3939
- do:
40-
xpack.ccr.unfollow_index:
40+
ccr.unfollow_index:
4141
index: bar
4242
- is_true: acknowledged

0 commit comments

Comments
 (0)