From 9d5b140a05c5dccf53db1f772420ef89beb9637a Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 11 Jul 2016 18:34:39 +0200 Subject: [PATCH] refreshing indices --- Handler/Commons.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Handler/Commons.hs b/Handler/Commons.hs index 822d851..c0a3f96 100755 --- a/Handler/Commons.hs +++ b/Handler/Commons.hs @@ -102,6 +102,7 @@ putIndexES input = do ) ex) _ <- runBH' $ openIndex (IndexName "user") runBH' $ indexDocument (IndexName "user") (MappingName "user") defaultIndexDocumentSettings user (DocId $ extractKey uId) + _ <- runBH' $ refreshIndex $ IndexName "user" ESAlbum aId album -> do ex <- runBH' $ indexExists (IndexName "album") unless ex ((\ _ -> do @@ -110,6 +111,7 @@ putIndexES input = do ) ex) _ <- runBH' $ openIndex (IndexName "album") runBH' $ indexDocument (IndexName "album") (MappingName "album") defaultIndexDocumentSettings album (DocId $ extractKey aId) + _ <- runBH' $ refreshIndex $ IndexName "album" ESMedium mId medium -> do ex <- runBH' $ indexExists (IndexName "medium") unless ex ((\ _ -> do @@ -118,6 +120,7 @@ putIndexES input = do ) ex) _ <- runBH' $ openIndex (IndexName "medium") runBH' $ indexDocument (IndexName "medium") (MappingName "medium") defaultIndexDocumentSettings medium (DocId $ extractKey mId) + _ <- runBH' $ refreshIndex $ IndexName "medium" ESComment cId comment -> do ex <- runBH' $ indexExists (IndexName "comment") unless ex ((\ _ -> do @@ -126,6 +129,7 @@ putIndexES input = do ) ex) _ <- runBH' $ openIndex (IndexName "comment") runBH' $ indexDocument (IndexName "comment") (MappingName "comment") defaultIndexDocumentSettings comment (DocId $ extractKey cId) + _ <- runBH' $ refreshIndex $ IndexName "comment" case statusCode (responseStatus resp) of 201 -> return () 200 -> return ()