git.iko.soy/typeable/bloodhound
on master help sign in
More optional fields
commit8ccc4fc4a8c5f5f7d24ee1a9e6cd18f7a90cf7a1 authorMichael Xavier <michael@michaelxavier.net> dateSat 17 Sep 2016, 18:25 (10 years ago) parent172be51
1 file changed+40−37
src/Database/Bloodhound/Types.hs+40−37
src/Database/Bloodhound/Types.hs+40−37
@@ -1739,7 +1739,7 @@ data TermsAggregation = TermsAggregation { term :: Either Text Text
17391739 , termAggs :: Maybe Aggregations
17401740 } deriving (Eq, Read, Show, Generic, Typeable)
17411741
1742−data CardinalityAggregation = CardinalityAggregation { cardinalityField :: FieldName,
1742+data CardinalityAggregation = CardinalityAggregation { cardinalityField :: FieldName,
17431743 precisionThreshold :: Maybe Int
17441744 } deriving (Eq, Read, Show, Generic, Typeable)
17451745
@@ -3882,7 +3882,7 @@ data NodesStats = NodesStats {
38823882data NodeStats = NodeStats {
38833883 nodeStatsName :: NodeName
38843884 , nodeStatsFullId :: FullNodeId
3885− , nodeStatsBreakersStats :: NodeBreakersStats
3885+ , nodeStatsBreakersStats :: Maybe NodeBreakersStats
38863886 , nodeStatsHTTP :: NodeHTTPStats
38873887 , nodeStatsTransport :: NodeTransportStats
38883888 , nodeStatsFS :: NodeFSStats
@@ -3938,7 +3938,7 @@ data NodeDataPathStats = NodeDataPathStats {
39383938 , nodeDataPathAvailable :: Bytes
39393939 , nodeDataPathFree :: Bytes
39403940 , nodeDataPathTotal :: Bytes
3941− , nodeDataPathType :: Text
3941+ , nodeDataPathType :: Maybe Text
39423942 , nodeDataPathDevice :: Text
39433943 , nodeDataPathMount :: Text
39443944 , nodeDataPathPath :: Text
@@ -3977,7 +3977,7 @@ data NodeThreadPoolsStats = NodeThreadPoolsStats {
39773977 , nodeThreadPoolsStatsMerge :: NodeThreadPoolStats
39783978 , nodeThreadPoolsStatsGet :: NodeThreadPoolStats
39793979 , nodeThreadPoolsStatsManagement :: NodeThreadPoolStats
3980− , nodeThreadPoolsStatsFetchShardStore :: NodeThreadPoolStats
3980+ , nodeThreadPoolsStatsFetchShardStore :: Maybe NodeThreadPoolStats
39813981 , nodeThreadPoolsStatsOptimize :: NodeThreadPoolStats
39823982 , nodeThreadPoolsStatsFlush :: NodeThreadPoolStats
39833983 , nodeThreadPoolsStatsSearch :: NodeThreadPoolStats
@@ -3986,8 +3986,8 @@ data NodeThreadPoolsStats = NodeThreadPoolsStats {
39863986 , nodeThreadPoolsStatsSuggest :: NodeThreadPoolStats
39873987 , nodeThreadPoolsStatsRefresh :: NodeThreadPoolStats
39883988 , nodeThreadPoolsStatsIndex :: NodeThreadPoolStats
3989− , nodeThreadPoolsStatsListener :: NodeThreadPoolStats
3990− , nodeThreadPoolsStatsFetchShardStarted :: NodeThreadPoolStats
3989+ , nodeThreadPoolsStatsListener :: Maybe NodeThreadPoolStats
3990+ , nodeThreadPoolsStatsFetchShardStarted :: Maybe NodeThreadPoolStats
39913991 , nodeThreadPoolsStatsPercolate :: NodeThreadPoolStats
39923992 } deriving (Eq, Show, Generic, Typeable)
39933993
@@ -4076,21 +4076,21 @@ data LoadAvgs = LoadAvgs {
40764076 } deriving (Eq, Show, Generic, Typeable)
40774077
40784078data NodeIndicesStats = NodeIndicesStats {
4079− nodeIndicesStatsRecoveryThrottleTime :: NominalDiffTime
4080− , nodeIndicesStatsRecoveryCurrentAsTarget :: Int
4081− , nodeIndicesStatsRecoveryCurrentAsSource :: Int
4082− , nodeIndicesStatsQueryCacheMisses :: Int
4083− , nodeIndicesStatsQueryCacheHits :: Int
4084− , nodeIndicesStatsQueryCacheEvictions :: Int
4085− , nodeIndicesStatsQueryCacheSize :: Bytes
4079+ nodeIndicesStatsRecoveryThrottleTime :: Maybe NominalDiffTime
4080+ , nodeIndicesStatsRecoveryCurrentAsTarget :: Maybe Int
4081+ , nodeIndicesStatsRecoveryCurrentAsSource :: Maybe Int
4082+ , nodeIndicesStatsQueryCacheMisses :: Maybe Int
4083+ , nodeIndicesStatsQueryCacheHits :: Maybe Int
4084+ , nodeIndicesStatsQueryCacheEvictions :: Maybe Int
4085+ , nodeIndicesStatsQueryCacheSize :: Maybe Bytes
40864086 , nodeIndicesStatsSuggestCurrent :: Int
40874087 , nodeIndicesStatsSuggestTime :: NominalDiffTime
40884088 , nodeIndicesStatsSuggestTotal :: Int
40894089 , nodeIndicesStatsTranslogSize :: Bytes
40904090 , nodeIndicesStatsTranslogOps :: Int
4091− , nodeIndicesStatsSegFixedBitSetMemory :: Bytes
4091+ , nodeIndicesStatsSegFixedBitSetMemory :: Maybe Bytes
40924092 , nodeIndicesStatsSegVersionMapMemory :: Bytes
4093− , nodeIndicesStatsSegIndexWriterMaxMemory :: Bytes
4093+ , nodeIndicesStatsSegIndexWriterMaxMemory :: Maybe Bytes
40944094 , nodeIndicesStatsSegIndexWriterMemory :: Bytes
40954095 , nodeIndicesStatsSegMemory :: Bytes
40964096 , nodeIndicesStatsSegCount :: Int
@@ -4133,9 +4133,9 @@ data NodeIndicesStats = NodeIndicesStats {
41334133 , nodeIndicesStatsGetExistsTotal :: Int
41344134 , nodeIndicesStatsGetTime :: NominalDiffTime
41354135 , nodeIndicesStatsGetTotal :: Int
4136− , nodeIndicesStatsIndexingThrottleTime :: NominalDiffTime
4137− , nodeIndicesStatsIndexingIsThrottled :: Bool
4138− , nodeIndicesStatsIndexingNoopUpdateTotal :: Int
4136+ , nodeIndicesStatsIndexingThrottleTime :: Maybe NominalDiffTime
4137+ , nodeIndicesStatsIndexingIsThrottled :: Maybe Bool
4138+ , nodeIndicesStatsIndexingNoopUpdateTotal :: Maybe Int
41394139 , nodeIndicesStatsIndexingDeleteCurrent :: Int
41404140 , nodeIndicesStatsIndexingDeleteTime :: NominalDiffTime
41414141 , nodeIndicesStatsIndexingDeleteTotal :: Int
@@ -4723,7 +4723,7 @@ instance FromJSON NodeDataPathStats where
47234723 <*> o .: "available_in_bytes"
47244724 <*> o .: "free_in_bytes"
47254725 <*> o .: "total_in_bytes"
4726− <*> o .: "type"
4726+ <*> o .:? "type"
47274727 <*> o .: "dev"
47284728 <*> o .: "mount"
47294729 <*> o .: "path"
@@ -4774,7 +4774,7 @@ instance FromJSON NodeThreadPoolsStats where
47744774 <*> o .: "merge"
47754775 <*> o .: "get"
47764776 <*> o .: "management"
4777− <*> o .: "fetch_shard_store"
4777+ <*> o .:? "fetch_shard_store"
47784778 <*> o .: "optimize"
47794779 <*> o .: "flush"
47804780 <*> o .: "search"
@@ -4783,8 +4783,8 @@ instance FromJSON NodeThreadPoolsStats where
47834783 <*> o .: "suggest"
47844784 <*> o .: "refresh"
47854785 <*> o .: "index"
4786− <*> o .: "listener"
4787− <*> o .: "fetch_shard_started"
4786+ <*> o .:? "listener"
4787+ <*> o .:? "fetch_shard_started"
47884788 <*> o .: "percolate"
47894789instance FromJSON NodeThreadPoolStats where
47904790 parseJSON = withObject "NodeThreadPoolStats" parse
@@ -4906,8 +4906,11 @@ instance FromJSON NodeIndicesStats where
49064906 parseJSON = withObject "NodeIndicesStats" parse
49074907 where
49084908 parse o = do
4909− recovery <- o .: "recovery"
4910− queryCache <- o .: "query_cache"
4909+ let (.::) mv k = case mv of
4910+ Just v -> Just <$> v .: k
4911+ Nothing -> pure Nothing
4912+ mRecovery <- o .:? "recovery"
4913+ mQueryCache <- o .:? "query_cache"
49114914 suggest <- o .: "suggest"
49124915 translog <- o .: "translog"
49134916 segments <- o .: "segments"
@@ -4925,21 +4928,21 @@ instance FromJSON NodeIndicesStats where
49254928 indexing <- o .: "indexing"
49264929 store <- o .: "store"
49274930 docs <- o .: "docs"
4928− NodeIndicesStats <$> (unMS <$> recovery .: "throttle_time_in_millis")
4929− <*> recovery .: "current_as_target"
4930− <*> recovery .: "current_as_source"
4931− <*> queryCache .: "miss_count"
4932− <*> queryCache .: "hit_count"
4933− <*> queryCache .: "evictions"
4934− <*> queryCache .: "memory_size_in_bytes"
4931+ NodeIndicesStats <$> (fmap unMS <$> mRecovery .:: "throttle_time_in_millis")
4932+ <*> mRecovery .:: "current_as_target"
4933+ <*> mRecovery .:: "current_as_source"
4934+ <*> mQueryCache .:: "miss_count"
4935+ <*> mQueryCache .:: "hit_count"
4936+ <*> mQueryCache .:: "evictions"
4937+ <*> mQueryCache .:: "memory_size_in_bytes"
49354938 <*> suggest .: "current"
49364939 <*> (unMS <$> suggest .: "time_in_millis")
49374940 <*> suggest .: "total"
49384941 <*> translog .: "size_in_bytes"
49394942 <*> translog .: "operations"
4940− <*> segments .: "fixed_bit_set_memory_in_bytes"
4943+ <*> segments .:? "fixed_bit_set_memory_in_bytes"
49414944 <*> segments .: "version_map_memory_in_bytes"
4942− <*> segments .: "index_writer_max_memory_in_bytes"
4945+ <*> segments .:? "index_writer_max_memory_in_bytes"
49434946 <*> segments .: "index_writer_memory_in_bytes"
49444947 <*> segments .: "memory_in_bytes"
49454948 <*> segments .: "count"
@@ -4982,9 +4985,9 @@ instance FromJSON NodeIndicesStats where
49824985 <*> getStats .: "exists_total"
49834986 <*> (unMS <$> getStats .: "time_in_millis")
49844987 <*> getStats .: "total"
4985− <*> (unMS <$> indexing .: "throttle_time_in_millis")
4986− <*> indexing .: "is_throttled"
4987− <*> indexing .: "noop_update_total"
4988+ <*> (fmap unMS <$> indexing .:? "throttle_time_in_millis")
4989+ <*> indexing .:? "is_throttled"
4990+ <*> indexing .:? "noop_update_total"
49884991 <*> indexing .: "delete_current"
49894992 <*> (unMS <$> indexing .: "delete_time_in_millis")
49904993 <*> indexing .: "delete_total"
@@ -5007,7 +5010,7 @@ parseNodeStats :: FullNodeId -> Object -> Parser NodeStats
50075010parseNodeStats fnid o = do
50085011 NodeStats <$> o .: "name"
50095012 <*> pure fnid
5010− <*> o .: "breakers"
5013+ <*> o .:? "breakers"
50115014 <*> o .: "http"
50125015 <*> o .: "transport"
50135016 <*> o .: "fs"