@@ -583,14 +583,17 @@ listIndices :: (MonadThrow m, MonadBH m) => m [IndexName]
583listIndices =
583listIndices =
584 parse . responseBody =<< get =<< url
584 parse . responseBody =<< get =<< url
586− url = joinPath ["_cat/indices?v"]
586+ url = joinPath ["_cat/indices?format=json"]
587− -- parses the tabular format the indices api provides
587+ parse body = maybe (throwM (EsProtocolException body)) return $ do
588− parse body = case T.lines (T.decodeUtf8 (L.toStrict body)) of
588+ vals <- decode body
589− (hdr:rows) -> let ks = T.words hdr
589+ forM vals $ \val -> do
590− keyedRows = [ HM.fromList (zip ks (T.words row)) | row <- rows ]
590+ case val of
591− names = catMaybes (HM.lookup "index" <$> keyedRows)
592+ indexVal <- HM.lookup "index" obj
592− in return (IndexName <$> names)
593+ case indexVal of
593− [] -> throwM (EsProtocolException body)
594+ String txt -> Just (IndexName txt)
595-- | 'updateIndexAliases' updates the server's index alias
598-- | 'updateIndexAliases' updates the server's index alias
596-- table. Operations are atomic. Explained in further detail at
599-- table. Operations are atomic. Explained in further detail at