diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/FollowExistingIndexAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/FollowExistingIndexAction.java index 0ea6de6fe7b..c200acf9ad7 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/FollowExistingIndexAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/FollowExistingIndexAction.java @@ -156,12 +156,14 @@ public class FollowExistingIndexAction extends Action client().execute(FollowExistingIndexAction.INSTANCE, followRequest).actionGet()); + // Follower index does not exist. + followRequest.setLeaderIndex("test-leader"); + followRequest.setFollowIndex("non-existent-follower"); + expectThrows(IllegalArgumentException.class, () -> client().execute(FollowExistingIndexAction.INSTANCE, followRequest).actionGet()); + // Both indices do not exist. + followRequest.setLeaderIndex("non-existent-leader"); + followRequest.setFollowIndex("non-existent-follower"); + expectThrows(IllegalArgumentException.class, () -> client().execute(FollowExistingIndexAction.INSTANCE, followRequest).actionGet()); + } + private CheckedRunnable assertTask(final int numberOfPrimaryShards, final Map numDocsPerShard) { return () -> { final ClusterState clusterState = client().admin().cluster().prepareState().get().getState();