@@ -267,6 +267,7 @@ module Database.Bloodhound.Types
267267 , RRGroupRefNum
268268 , rrGroupRefNum
269269 , mkRRGroupRefNum
270+ , RestoreIndexSettings(..)
270271
271272 , Aggregation(..)
272273 , Aggregations
@@ -3979,8 +3980,16 @@ data SnapshotRestoreSettings = SnapshotRestoreSettings {
39793980 , snapRestoreIncludeAliases :: Bool
39803981 -- ^ Should the restore also restore the aliases captured in the
39813982 -- snapshot.
3983+ , snapRestoreIndexSettingsOverrides :: Maybe RestoreIndexSettings
3984+ -- ^ Settings to apply during the restore process.
3985+ , snapRestoreIgnoreIndexSettings :: Maybe (NonEmpty Text)
3986+ -- ^ This type could be more rich but it isn't clear which
3987+ -- settings are allowed to be ignored during restore, so we're
3988+ -- going with including this feature in a basic form rather than
3989+ -- omitting it. One example here would be
3990+ -- "index.refresh_interval". Any setting specified here will
3991+ -- revert back to the server default during the restore process.
39823992 } deriving (Eq, Generic, Show, Typeable)
3983−--TODO: temporary settings changes
39843993
39853994-- | Regex-stype pattern, e.g. "index_(.+)" to match index names
39863995newtype RestoreRenamePattern = RestoreRenamePattern { rrPattern :: Text }
@@ -4030,6 +4039,8 @@ mkRRGroupRefNum i
40304039-- * snapRestoreRenameReplacement Nothing
40314040-- * snapRestorePartial False
40324041-- * snapRestoreIncludeAliases True
4042+-- * snapRestoreIndexSettingsOverrides Nothing
4043+-- * snapRestoreIgnoreIndexSettings Nothing
40334044defaultSnapshotRestoreSettings :: SnapshotRestoreSettings
40344045defaultSnapshotRestoreSettings = SnapshotRestoreSettings {
40354046 snapRestoreWaitForCompletion = False
@@ -4040,4 +4051,20 @@ defaultSnapshotRestoreSettings = SnapshotRestoreSettings {
40404051 , snapRestoreRenameReplacement = Nothing
40414052 , snapRestorePartial = False
40424053 , snapRestoreIncludeAliases = True
4054+ , snapRestoreIndexSettingsOverrides = Nothing
4055+ , snapRestoreIgnoreIndexSettings = Nothing
40434056 }
4057+
4058+
4059+-- | Index settings that can be overridden. The docs only mention you
4060+-- can update number of replicas, but there may be more. You
4061+-- definitely cannot override shard count.
4062+data RestoreIndexSettings = RestoreIndexSettings {
4063+ restoreOverrideReplicas :: Maybe ReplicaCount
4064+ } deriving (Show, Eq, Generic, Typeable)
4065+
4066+
4067+instance ToJSON RestoreIndexSettings where
4068+ toJSON RestoreIndexSettings {..} = object prs
4069+ where
4070+ prs = catMaybes [("index.number_of_replicas" .=) <$> restoreOverrideReplicas]