@@ -267,6 +267,7 @@ module Database.Bloodhound.Types
267 , RRGroupRefNum
267 , RRGroupRefNum
268 , rrGroupRefNum
268 , rrGroupRefNum
269 , mkRRGroupRefNum
269 , mkRRGroupRefNum
270+ , RestoreIndexSettings(..)
271 , Aggregation(..)
272 , Aggregation(..)
272 , Aggregations
273 , Aggregations
@@ -3979,8 +3980,16 @@ data SnapshotRestoreSettings = SnapshotRestoreSettings {
3979 , snapRestoreIncludeAliases :: Bool
3980 , snapRestoreIncludeAliases :: Bool
3980 -- ^ Should the restore also restore the aliases captured in the
3981 -- ^ Should the restore also restore the aliases captured in the
3981 -- snapshot.
3982 -- 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.
3982 } deriving (Eq, Generic, Show, Typeable)
3992 } deriving (Eq, Generic, Show, Typeable)
3983−--TODO: temporary settings changes
3985-- | Regex-stype pattern, e.g. "index_(.+)" to match index names
3994-- | Regex-stype pattern, e.g. "index_(.+)" to match index names
3986newtype RestoreRenamePattern = RestoreRenamePattern { rrPattern :: Text }
3995newtype RestoreRenamePattern = RestoreRenamePattern { rrPattern :: Text }
@@ -4030,6 +4039,8 @@ mkRRGroupRefNum i
4030-- * snapRestoreRenameReplacement Nothing
4039-- * snapRestoreRenameReplacement Nothing
4031-- * snapRestorePartial False
4040-- * snapRestorePartial False
4032-- * snapRestoreIncludeAliases True
4041-- * snapRestoreIncludeAliases True
4042+-- * snapRestoreIndexSettingsOverrides Nothing
4043+-- * snapRestoreIgnoreIndexSettings Nothing
4033defaultSnapshotRestoreSettings :: SnapshotRestoreSettings
4044defaultSnapshotRestoreSettings :: SnapshotRestoreSettings
4034defaultSnapshotRestoreSettings = SnapshotRestoreSettings {
4045defaultSnapshotRestoreSettings = SnapshotRestoreSettings {
4035 snapRestoreWaitForCompletion = False
4046 snapRestoreWaitForCompletion = False
@@ -4040,4 +4051,20 @@ defaultSnapshotRestoreSettings = SnapshotRestoreSettings {
4040 , snapRestoreRenameReplacement = Nothing
4051 , snapRestoreRenameReplacement = Nothing
4041 , snapRestorePartial = False
4052 , snapRestorePartial = False
4042 , snapRestoreIncludeAliases = True
4053 , snapRestoreIncludeAliases = True
4054+ , snapRestoreIndexSettingsOverrides = Nothing
4055+ , snapRestoreIgnoreIndexSettings = Nothing
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)
4067+instance ToJSON RestoreIndexSettings where
4068+ toJSON RestoreIndexSettings {..} = object prs
4070+ prs = catMaybes [("index.number_of_replicas" .=) <$> restoreOverrideReplicas]