From 3b84cfa3ec11c4b792503289bd7f926448e82cde Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 09:43:08 -0700 Subject: [PATCH] create query index at the time of monitor creation (#1674) (#1675) (#1684) (cherry picked from commit 15518fa53e9c2f159fd7b706cd1fc02c16a92fb4) Signed-off-by: Subhobrata Dey Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../transport/TransportIndexMonitorAction.kt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt index 0a5d60965..a29ac1a9d 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt @@ -548,8 +548,7 @@ class TransportIndexMonitorAction @Inject constructor( if ( request.monitor.isMonitorOfStandardType() && Monitor.MonitorType.valueOf(request.monitor.monitorType.uppercase(Locale.ROOT)) == - Monitor.MonitorType.DOC_LEVEL_MONITOR && - request.monitor.deleteQueryIndexInEveryRun == false + Monitor.MonitorType.DOC_LEVEL_MONITOR ) { indexDocLevelMonitorQueries(request.monitor, indexResponse.id, metadata, request.refreshPolicy) } @@ -728,14 +727,12 @@ class TransportIndexMonitorAction @Inject constructor( .execute(it) } } - if (currentMonitor.deleteQueryIndexInEveryRun == false) { - indexDocLevelMonitorQueries( - request.monitor, - currentMonitor.id, - updatedMetadata, - request.refreshPolicy - ) - } + indexDocLevelMonitorQueries( + request.monitor, + currentMonitor.id, + updatedMetadata, + request.refreshPolicy + ) MonitorMetadataService.upsertMetadata(updatedMetadata, updating = true) } actionListener.onResponse(