From 87bfce699eef052680b2c51683b4de9ac331fe83 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:50:12 -0700 Subject: [PATCH] create query index at the time of monitor creation (#1674) (#1675) Signed-off-by: Subhobrata Dey --- .../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(