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.
This commit is contained in:
Jason Tedor 2018-08-02 20:21:43 -04:00 committed by GitHub
parent 9f96073e64
commit 2387616c80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 26 deletions

View File

@ -76,7 +76,7 @@ public class FollowIndexSecurityIT extends ESRestTestCase {
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")));
@ -87,7 +87,7 @@ public class FollowIndexSecurityIT extends ESRestTestCase {
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")));
@ -144,13 +144,13 @@ public class FollowIndexSecurityIT extends ESRestTestCase {
}
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));
}

View File

@ -94,19 +94,19 @@ public class FollowIndexIT extends ESRestTestCase {
}
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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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
@ -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