Skip to content

Commit

Permalink
onboard system and hidden index
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Aug 18, 2023
1 parent d36b9c0 commit bb0e550
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.opensearch.core.common.io.stream.NamedWriteableRegistry
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.env.Environment
import org.opensearch.env.NodeEnvironment
import org.opensearch.indices.SystemIndexDescriptor
import org.opensearch.notifications.action.CreateNotificationConfigAction
import org.opensearch.notifications.action.DeleteNotificationConfigAction
import org.opensearch.notifications.action.GetChannelListAction
Expand All @@ -44,6 +45,7 @@ import org.opensearch.notifications.spi.NotificationCore
import org.opensearch.notifications.spi.NotificationCoreExtension
import org.opensearch.plugins.ActionPlugin
import org.opensearch.plugins.Plugin
import org.opensearch.plugins.SystemIndexPlugin
import org.opensearch.repositories.RepositoriesService
import org.opensearch.rest.RestController
import org.opensearch.rest.RestHandler
Expand All @@ -56,7 +58,7 @@ import java.util.function.Supplier
* Entry point of the OpenSearch Notifications plugin
* This class initializes the rest handlers.
*/
class NotificationPlugin : ActionPlugin, Plugin(), NotificationCoreExtension {
class NotificationPlugin : ActionPlugin, Plugin(), NotificationCoreExtension, SystemIndexPlugin {

lateinit var clusterService: ClusterService // initialized in createComponents()

Expand All @@ -80,6 +82,15 @@ class NotificationPlugin : ActionPlugin, Plugin(), NotificationCoreExtension {
return PluginSettings.getAllSettings()
}

override fun getSystemIndexDescriptors(settings: Settings?): Collection<SystemIndexDescriptor> {
return listOf(
SystemIndexDescriptor(
NotificationConfigIndex.INDEX_NAME,
"System index for storing notification channels related configurations."
)
)
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal object NotificationConfigIndex : ConfigOperations {
const val SCHEMA_VERSION = "schema_version"

private val log by logger(NotificationConfigIndex::class.java)
private const val INDEX_NAME = ".opensearch-notifications-config"
const val INDEX_NAME = ".opensearch-notifications-config"
private const val MAPPING_FILE_NAME = "notifications-config-mapping.yml"
private const val SETTINGS_FILE_NAME = "notifications-config-settings.yml"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
index:
number_of_shards: "1" # The data size is not expected to be big so keeping it 1 shard
auto_expand_replicas: "0-2"
hidden: true

0 comments on commit bb0e550

Please sign in to comment.