From ef94468a8b21fb95e4fecabbfd953df433c670f0 Mon Sep 17 00:00:00 2001 From: Chase Engelbrecht Date: Thu, 14 Mar 2024 20:00:19 -0700 Subject: [PATCH] Revert behavior for no rules in detector Signed-off-by: Chase Engelbrecht --- .../transport/TransportIndexDetectorAction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java index c21f7d3f8..cf9835568 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java @@ -274,9 +274,9 @@ private void createMonitorFromQueries(String index, List> rul }, listener::onFailure); }, listener::onFailure); } else { - // Failure if detector doesn't have any monitor + // Do nothing if detector doesn't have any monitor if (monitorRequests.isEmpty()) { - listener.onFailure(new OpenSearchStatusException("Detector cannot be created as no compatible rules were provided", RestStatus.BAD_REQUEST)); + listener.onResponse(Collections.emptyList()); return; } List monitorResponses = new ArrayList<>();