From 0396d26379371e80c5fd65aac5318cf57bad06be Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Mon, 20 Jan 2025 13:51:17 +0100 Subject: [PATCH] /i/index/refresh : Refresh additional index on same ElasticSearch This case was missing: The additional index can reside on the same ElasticSearch instance as the normal/default one. --- services/brig/src/Brig/User/Search/Index.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/brig/src/Brig/User/Search/Index.hs b/services/brig/src/Brig/User/Search/Index.hs index 6fee8b6eb9b..1364e0dc0c9 100644 --- a/services/brig/src/Brig/User/Search/Index.hs +++ b/services/brig/src/Brig/User/Search/Index.hs @@ -132,8 +132,14 @@ refreshIndexes = liftIndexIO $ do mbAddElasticEnv <- asks idxAdditionalElastic case (mbAddIdx, mbAddElasticEnv) of (Just addIdx, Just addElasticEnv) -> + -- Refresh additional index on a separate ElasticSearch instance. ES.runBH addElasticEnv ((void . ES.refreshIndex) addIdx) - (_, _) -> pure () + (Just addIdx, Nothing) -> + -- Refresh additional index on the same ElasticSearch instance. + void $ ES.refreshIndex addIdx + (Nothing, _) -> + -- No additional index + pure () createIndexIfNotPresent :: (MonadIndexIO m) =>