@@ -56,7 +56,8 @@ module Database.Bloodhound.Types
5656 , Existence(..)
5757 , NullValue(..)
5858 , IndexSettings(..)
59− , IndexSettingUpdate(..)
59+ , UpdatableIndexSetting(..)
60+ , IndexSettingsSummary(..)
6061 , AllocationPolicy(..)
6162 , ReplicaBounds(..)
6263 , Bytes(..)
@@ -357,58 +358,59 @@ data IndexSettings =
357358defaultIndexSettings :: IndexSettings
358359defaultIndexSettings = IndexSettings (ShardCount 3) (ReplicaCount 2)
359360
360−{-| 'IndexSettingUpdate' is used to update an index' settings piecemeal.
361+{-| 'UpdatableIndexSetting' are settings which may be updated after an index is created.
361362
362363 <https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html>
363364-}
364−data IndexSettingUpdate = NumberOfReplicas Int
365− -- ^ The number of replicas each shard has.
366− | AutoExpandReplicas ReplicaBounds
367− | BlocksReadOnly Bool
368− -- ^ Set to True to have the index read only. False to allow writes and metadata changes.
369− | BlocksRead Bool
370− -- ^ Set to True to disable read operations against the index.
371− | BlocksWrite Bool
372− -- ^ Set to True to disable write operations against the index.
373− | BlocksMetaData Bool
374− -- ^ Set to True to disable metadata operations against the index.
375− | RefreshInterval NominalDiffTime
376− -- ^ The async refresh interval of a shard
377− | IndexConcurrency Int
378− | FailOnMergeFailure Bool
379− | TranslogFlushThresholdOps Int
380− -- ^ When to flush on operations.
381− | TranslogFlushThresholdSize Bytes
382− -- ^ When to flush based on translog (bytes) size.
383− | TranslogFlushThresholdPeriod NominalDiffTime
384− -- ^ When to flush based on a period of not flushing.
385− | TranslogDisableFlush Bool
386− -- ^ Disables flushing. Note, should be set for a short interval and then enabled.
387− | CacheFilterMaxSize (Maybe Bytes)
388− -- ^ The maximum size of filter cache (per segment in shard).
389− | CacheFilterExpire (Maybe NominalDiffTime)
390− -- ^ The expire after access time for filter cache.
391− | GatewaySnapshotInterval NominalDiffTime
392− -- ^ The gateway snapshot interval (only applies to shared gateways).
393− | RoutingAllocationInclude (NonEmpty NodeAttrFilter)
394− -- ^ A node matching any rule will be allowed to host shards from the index.
395− | RoutingAllocationExclude (NonEmpty NodeAttrFilter)
396− -- ^ A node matching any rule will NOT be allowed to host shards from the index.
397− | RoutingAllocationRequire (NonEmpty NodeAttrFilter)
398− -- ^ Only nodes matching all rules will be allowed to host shards from the index.
399− | RoutingAllocationEnable AllocationPolicy
400− -- ^ Enables shard allocation for a specific index.
401− | RoutingAllocationShardsPerNode ShardCount
402− -- ^ Controls the total number of shards (replicas and primaries) allowed to be allocated on a single node.
403− | RecoveryInitialShards InitialShardCount
404− -- ^ When using local gateway a particular shard is recovered only if there can be allocated quorum shards in the cluster.
405− | GCDeletes NominalDiffTime
406− | TTLDisablePurge Bool
407− -- ^ Disables temporarily the purge of expired docs.
408− | TranslogFSType FSType
409− | IndexCompoundFormat CompoundFormat
410− | IndexCompoundOnFlush Bool
411− | WarmerEnabled Bool
365+data UpdatableIndexSetting = NumberOfReplicas ReplicaCount
366+ -- ^ The number of replicas each shard has.
367+ | AutoExpandReplicas ReplicaBounds
368+ | BlocksReadOnly Bool
369+ -- ^ Set to True to have the index read only. False to allow writes and metadata changes.
370+ | BlocksRead Bool
371+ -- ^ Set to True to disable read operations against the index.
372+ | BlocksWrite Bool
373+ -- ^ Set to True to disable write operations against the index.
374+ | BlocksMetaData Bool
375+ -- ^ Set to True to disable metadata operations against the index.
376+ | RefreshInterval NominalDiffTime
377+ -- ^ The async refresh interval of a shard
378+ | IndexConcurrency Int
379+ | FailOnMergeFailure Bool
380+ | TranslogFlushThresholdOps Int
381+ -- ^ When to flush on operations.
382+ | TranslogFlushThresholdSize Bytes
383+ -- ^ When to flush based on translog (bytes) size.
384+ | TranslogFlushThresholdPeriod NominalDiffTime
385+ -- ^ When to flush based on a period of not flushing.
386+ | TranslogDisableFlush Bool
387+ -- ^ Disables flushing. Note, should be set for a short interval and then enabled.
388+ | CacheFilterMaxSize (Maybe Bytes)
389+ -- ^ The maximum size of filter cache (per segment in shard).
390+ | CacheFilterExpire (Maybe NominalDiffTime)
391+ -- ^ The expire after access time for filter cache.
392+ | GatewaySnapshotInterval NominalDiffTime
393+ -- ^ The gateway snapshot interval (only applies to shared gateways).
394+ | RoutingAllocationInclude (NonEmpty NodeAttrFilter)
395+ -- ^ A node matching any rule will be allowed to host shards from the index.
396+ | RoutingAllocationExclude (NonEmpty NodeAttrFilter)
397+ -- ^ A node matching any rule will NOT be allowed to host shards from the index.
398+ | RoutingAllocationRequire (NonEmpty NodeAttrFilter)
399+ -- ^ Only nodes matching all rules will be allowed to host shards from the index.
400+ | RoutingAllocationEnable AllocationPolicy
401+ -- ^ Enables shard allocation for a specific index.
402+ | RoutingAllocationShardsPerNode ShardCount
403+ -- ^ Controls the total number of shards (replicas and primaries) allowed to be allocated on a single node.
404+ | RecoveryInitialShards InitialShardCount
405+ -- ^ When using local gateway a particular shard is recovered only if there can be allocated quorum shards in the cluster.
406+ | GCDeletes NominalDiffTime
407+ | TTLDisablePurge Bool
408+ -- ^ Disables temporarily the purge of expired docs.
409+ | TranslogFSType FSType
410+ | IndexCompoundFormat CompoundFormat
411+ | IndexCompoundOnFlush Bool
412+ | WarmerEnabled Bool
413+ deriving (Eq, Show)
412414
413415data AllocationPolicy = AllocAll
414416 -- ^ Allows shard allocation for all shards.
@@ -418,10 +420,12 @@ data AllocationPolicy = AllocAll
418420 -- ^ Allows shard allocation only for primary shards for new indices.
419421 | AllocNone
420422 -- ^ No shard allocation is allowed
423+ deriving (Eq, Show)
421424
422425data ReplicaBounds = ReplicasBounded Int Int
423426 | ReplicasLowerBounded Int
424427 | ReplicasUnbounded
428+ deriving (Eq, Show)
425429
426430newtype Bytes = Bytes Int deriving (Eq, Show, Ord, ToJSON)
427431
@@ -433,18 +437,25 @@ data InitialShardCount = QuorumShards
433437 | FullShards
434438 | FullMinus1Shards
435439 | ExplicitShards Int
440+ deriving (Eq, Show)
436441
437442data NodeAttrFilter = NodeAttrFilter { nodeAttrFilterName :: NodeAttrName
438443 , nodeAttrFilterValues :: NonEmpty Text}
444+ deriving (Eq, Show)
439445
440−newtype NodeAttrName = NodeAttrName Text
446+newtype NodeAttrName = NodeAttrName Text deriving (Eq, Show)
441447
442448data CompoundFormat = CompoundFileFormat Bool
443449 | MergeSegmentVsTotalIndex Double
444450 -- ^ percentage between 0 and 1 where 0 is false, 1 is true
451+ deriving (Eq, Show)
445452
446453newtype NominalDiffTimeJSON = NominalDiffTimeJSON NominalDiffTime
447454
455+data IndexSettingsSummary = IndexSettingsSummary { sSummaryShardCount :: ShardCount
456+ , sSummaryUpdateable :: [UpdatableIndexSetting]}
457+ deriving (Eq, Show)
458+
448459{-| 'Reply' and 'Method' are type synonyms from 'Network.HTTP.Types.Method.Method' -}
449460type Reply = Network.HTTP.Client.Response L.ByteString
450461type Method = NHTM.Method
@@ -2250,7 +2261,7 @@ instance ToJSON IndexSettings where
22502261 ]
22512262 ]
22522263
2253−instance ToJSON IndexSettingUpdate where
2264+instance ToJSON UpdatableIndexSetting where
22542265 toJSON (NumberOfReplicas x) = oPath ("index" :| ["number_of_replicas"]) x
22552266 toJSON (AutoExpandReplicas x) = oPath ("index" :| ["auto_expand_replicas"]) x
22562267 toJSON (BlocksReadOnly x) = oPath ("blocks" :| ["read_only"]) x
@@ -2270,9 +2281,6 @@ instance ToJSON IndexSettingUpdate where
22702281 toJSON (RoutingAllocationInclude fs) = oPath ("index" :| ["routing", "allocation", "include"]) (attrFilterJSON fs)
22712282 toJSON (RoutingAllocationExclude fs) = oPath ("index" :| ["routing", "allocation", "exclude"]) (attrFilterJSON fs)
22722283 toJSON (RoutingAllocationRequire fs) = oPath ("index" :| ["routing", "allocation", "require"]) (attrFilterJSON fs)
2273− toJSON (RoutingAllocationDisable x) = oPath ("index" :| ["routing", "allocation", "disable_allocation"]) x
2274− toJSON (RoutingAllocationDisableNew x) = oPath ("index" :| ["routing", "allocation", "disable_new_allocation"]) x
2275− toJSON (RoutingAllocationDisableReplica x) = oPath ("index" :| ["routing", "allocation", "disable_replica_allocation"]) x
22762284 toJSON (RoutingAllocationEnable x) = oPath ("index" :| ["routing", "allocation", "enable"]) x
22772285 toJSON (RoutingAllocationShardsPerNode x) = oPath ("index" :| ["routing", "allocation", "total_shards_per_node"]) x
22782286 toJSON (RecoveryInitialShards x) = oPath ("index" :| ["recovery", "initial_shards"]) x