@@ -532,10 +532,6 @@ createIndexWith updates shards (IndexName indexName) =
535−oPath :: ToJSON a => NonEmpty Text -> a -> Value
536−oPath (k :| []) v = object [k .= v]
537−oPath (k:| (h:t)) v = object [k .= oPath (h :| t) v]
539-- | 'deleteIndex' will delete an index given a 'Server', and an 'IndexName'.
535-- | 'deleteIndex' will delete an index given a 'Server', and an 'IndexName'.
541-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
537-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
@@ -703,14 +699,17 @@ listIndices :: (MonadThrow m, MonadBH m) => m [IndexName]
703listIndices =
699listIndices =
704 parse . responseBody =<< get =<< url
700 parse . responseBody =<< get =<< url
706− url = joinPath ["_cat/indices?v"]
702+ url = joinPath ["_cat/indices?format=json"]
707− -- parses the tabular format the indices api provides
703+ parse body = maybe (throwM (EsProtocolException body)) return $ do
708− parse body = case T.lines (T.decodeUtf8 (L.toStrict body)) of
704+ vals <- decode body
709− (hdr:rows) -> let ks = T.words hdr
705+ forM vals $ \val -> do
710− keyedRows = [ HM.fromList (zip ks (T.words row)) | row <- rows ]
706+ case val of
711− names = catMaybes (HM.lookup "index" <$> keyedRows)
708+ indexVal <- HM.lookup "index" obj
712− in return (IndexName <$> names)
709+ case indexVal of
713− [] -> throwM (EsProtocolException body)
710+ String txt -> Just (IndexName txt)
715-- | 'updateIndexAliases' updates the server's index alias
714-- | 'updateIndexAliases' updates the server's index alias
716-- table. Operations are atomic. Explained in further detail at
715-- table. Operations are atomic. Explained in further detail at