@@ -15,6 +15,7 @@ import org.opensearch.alerting.action.GetRemoteIndexesAction
15
15
import org.opensearch.alerting.action.SearchEmailAccountAction
16
16
import org.opensearch.alerting.action.SearchEmailGroupAction
17
17
import org.opensearch.alerting.alerts.AlertIndices
18
+ import org.opensearch.alerting.alerts.AlertIndices.Companion.ALL_ALERT_INDEX_PATTERN
18
19
import org.opensearch.alerting.core.JobSweeper
19
20
import org.opensearch.alerting.core.ScheduledJobIndices
20
21
import org.opensearch.alerting.core.action.node.ScheduledJobsStatsAction
@@ -96,6 +97,7 @@ import org.opensearch.commons.alerting.model.DocumentLevelTrigger
96
97
import org.opensearch.commons.alerting.model.Monitor
97
98
import org.opensearch.commons.alerting.model.QueryLevelTrigger
98
99
import org.opensearch.commons.alerting.model.ScheduledJob
100
+ import org.opensearch.commons.alerting.model.ScheduledJob.Companion.SCHEDULED_JOBS_INDEX
99
101
import org.opensearch.commons.alerting.model.SearchInput
100
102
import org.opensearch.commons.alerting.model.Workflow
101
103
import org.opensearch.commons.alerting.model.remote.monitors.RemoteMonitorTrigger
@@ -107,6 +109,7 @@ import org.opensearch.core.xcontent.XContentParser
107
109
import org.opensearch.env.Environment
108
110
import org.opensearch.env.NodeEnvironment
109
111
import org.opensearch.index.IndexModule
112
+ import org.opensearch.indices.SystemIndexDescriptor
110
113
import org.opensearch.monitor.jvm.JvmStats
111
114
import org.opensearch.painless.spi.PainlessExtension
112
115
import org.opensearch.painless.spi.Whitelist
@@ -117,6 +120,7 @@ import org.opensearch.plugins.ExtensiblePlugin
117
120
import org.opensearch.plugins.ReloadablePlugin
118
121
import org.opensearch.plugins.ScriptPlugin
119
122
import org.opensearch.plugins.SearchPlugin
123
+ import org.opensearch.plugins.SystemIndexPlugin
120
124
import org.opensearch.repositories.RepositoriesService
121
125
import org.opensearch.rest.RestController
122
126
import org.opensearch.rest.RestHandler
@@ -132,7 +136,8 @@ import java.util.function.Supplier
132
136
* It also adds [Monitor.XCONTENT_REGISTRY], [SearchInput.XCONTENT_REGISTRY], [QueryLevelTrigger.XCONTENT_REGISTRY],
133
137
* [BucketLevelTrigger.XCONTENT_REGISTRY], [ClusterMetricsInput.XCONTENT_REGISTRY] to the [NamedXContentRegistry] so that we are able to deserialize the custom named objects.
134
138
*/
135
- internal class AlertingPlugin : PainlessExtension , ActionPlugin , ScriptPlugin , ReloadablePlugin , SearchPlugin , PercolatorPluginExt () {
139
+ internal class AlertingPlugin : PainlessExtension , ActionPlugin , ScriptPlugin , ReloadablePlugin ,
140
+ SearchPlugin , SystemIndexPlugin , PercolatorPluginExt () {
136
141
137
142
override fun getContextWhitelists (): Map <ScriptContext <* >, List<Whitelist>> {
138
143
val whitelist = WhitelistLoader .loadFromResourceFiles(javaClass, " org.opensearch.alerting.txt" )
@@ -410,6 +415,13 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, R
410
415
return listOf (TriggerScript .CONTEXT )
411
416
}
412
417
418
+ override fun getSystemIndexDescriptors (settings : Settings ): Collection <SystemIndexDescriptor > {
419
+ return listOf (
420
+ SystemIndexDescriptor (ALL_ALERT_INDEX_PATTERN , " Alerting Plugin system index pattern" ),
421
+ SystemIndexDescriptor (SCHEDULED_JOBS_INDEX , " Alerting Plugin Configuration index" )
422
+ )
423
+ }
424
+
413
425
override fun reload (settings : Settings ) {
414
426
runner.reloadDestinationSettings(settings)
415
427
}
0 commit comments