From e57da524ebec5f8a118da92845d0c8bbd5e8af6c Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Fri, 2 Aug 2024 15:04:49 +0800 Subject: [PATCH] setPrimary for different alert_type --- src/main/java/org/opensearch/agent/tools/RCATool.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/agent/tools/RCATool.java b/src/main/java/org/opensearch/agent/tools/RCATool.java index a2c60a37..9730f58a 100644 --- a/src/main/java/org/opensearch/agent/tools/RCATool.java +++ b/src/main/java/org/opensearch/agent/tools/RCATool.java @@ -178,7 +178,7 @@ private String invokeAPI(String url, Map parameters) { case "_cluster/allocation/explain": ClusterAllocationExplainRequest request = new ClusterAllocationExplainRequest(); request.setIndex(parameters.get("index")); - request.setPrimary(true); + request.setPrimary(parameters.getOrDefault("alert_type", "").equals("CLUSTER_RED")); request.setShard(0); try { // TODO: need to be optimized to use listener to avoid block wait