Skip to content

Commit

Permalink
Use wait_for_active_shards in put follow api call when upgrading fr…
Browse files Browse the repository at this point in the history
…om 6.7.0 or higher.

Closes elastic#40677
  • Loading branch information
martijnvg committed Apr 1, 2019
1 parent 106a288 commit 732a723
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ private static void createIndex(RestClient client, String name, Settings setting
}

private static void followIndex(RestClient client, String leaderCluster, String leaderIndex, String followIndex) throws IOException {
final Request request = new Request("PUT", "/" + followIndex + "/_ccr/follow");
String endpoint = "/" + followIndex + "/_ccr/follow";
if (UPGRADE_FROM_VERSION.onOrAfter(Version.V_6_7_0)) {
endpoint += "?wait_for_active_shards=1";
}
final Request request = new Request("PUT", endpoint);
request.setJsonEntity("{\"remote_cluster\": \"" + leaderCluster + "\", \"leader_index\": \"" + leaderIndex +
"\", \"read_poll_timeout\": \"10ms\"}");
assertOK(client.performRequest(request));
Expand Down

0 comments on commit 732a723

Please sign in to comment.