@@ -33,7 +33,7 @@ import org.opensearch.action.support.HandledTransportAction
3333import org.opensearch.action.support.IndicesOptions
3434import org.opensearch.client.Client
3535import org.opensearch.cluster.ClusterState
36- import org.opensearch.cluster.metadata.IndexMetadata
36+ import org.opensearch.cluster.metadata.MetadataCreateIndexService
3737import org.opensearch.common.inject.Inject
3838import org.opensearch.common.settings.Settings
3939import org.opensearch.env.Environment
@@ -48,7 +48,8 @@ class TransportReplicateIndexAction @Inject constructor(transportService: Transp
4848 val threadPool : ThreadPool ,
4949 actionFilters : ActionFilters ,
5050 private val client : Client ,
51- private val environment : Environment ) :
51+ private val environment : Environment ,
52+ private val metadataCreateIndexService : MetadataCreateIndexService ) :
5253 HandledTransportAction <ReplicateIndexRequest , ReplicateIndexResponse >(ReplicateIndexAction .NAME ,
5354 transportService, actionFilters, ::ReplicateIndexRequest ),
5455 CoroutineScope by GlobalScope {
@@ -102,7 +103,13 @@ class TransportReplicateIndexAction @Inject constructor(transportService: Transp
102103 throw IllegalArgumentException (" Cannot replicate k-NN index - ${request.leaderIndex} " )
103104 }
104105
105- ValidationUtil .validateAnalyzerSettings(environment, leaderSettings, request.settings)
106+ ValidationUtil .validateIndexSettings(
107+ environment,
108+ request.followerIndex,
109+ leaderSettings,
110+ request.settings,
111+ metadataCreateIndexService
112+ )
106113
107114 // Setup checks are successful and trigger replication for the index
108115 // permissions evaluation to trigger replication is based on the current security context set
@@ -128,7 +135,7 @@ class TransportReplicateIndexAction @Inject constructor(transportService: Transp
128135
129136 private suspend fun getLeaderIndexSettings (leaderAlias : String , leaderIndex : String ): Settings {
130137 val remoteClient = client.getRemoteClusterClient(leaderAlias)
131- val getSettingsRequest = GetSettingsRequest ().includeDefaults(false ).indices(leaderIndex)
138+ val getSettingsRequest = GetSettingsRequest ().includeDefaults(true ).indices(leaderIndex)
132139 val settingsResponse = remoteClient.suspending(remoteClient.admin().indices()::getSettings,
133140 injectSecurityContext = true )(getSettingsRequest)
134141 return settingsResponse.indexToSettings.get(leaderIndex) ? : throw IndexNotFoundException (" ${leaderAlias} :${leaderIndex} " )
0 commit comments