From bf493320523e7f619cdd41df3f66f9db22bf0e6f Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Mon, 4 Feb 2019 17:01:15 -0800 Subject: [PATCH] Skip call to ccr stats api if follower index is paused --- .../server/routes/api/follower_index.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/server/routes/api/follower_index.js b/x-pack/plugins/cross_cluster_replication/server/routes/api/follower_index.js index 5cb9d4babd8cf..81e0990c7691c 100644 --- a/x-pack/plugins/cross_cluster_replication/server/routes/api/follower_index.js +++ b/x-pack/plugins/cross_cluster_replication/server/routes/api/follower_index.js @@ -94,14 +94,21 @@ export const registerFollowerIndexRoutes = (server) => { throw(error); } - const { - indices: followerIndicesStats - } = await callWithRequest('ccr.followerIndexStats', { id }); + // If this follower is paused, skip call to ES stats api since it will return 404 + if(followerIndexInfo.status === 'paused') { + return deserializeFollowerIndex({ + ...followerIndexInfo + }); + } else { + const { + indices: followerIndicesStats + } = await callWithRequest('ccr.followerIndexStats', { id }); - return deserializeFollowerIndex({ - ...followerIndexInfo, - ...(followerIndicesStats ? followerIndicesStats[0] : {}) - }); + return deserializeFollowerIndex({ + ...followerIndexInfo, + ...(followerIndicesStats ? followerIndicesStats[0] : {}) + }); + } } catch(err) { if (isEsError(err)) { throw wrapEsError(err);