From 0a37821f8360b6ba7f5c99b114cad9d8f89d97ff Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Sep 2024 16:51:46 +0000 Subject: [PATCH] create query index at the time of monitor creation (#1674) Signed-off-by: Subhobrata Dey (cherry picked from commit 5b27d24f765a4bbc3940bb73a1e9a8c526329271) Signed-off-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(