refreshing indices

This commit is contained in:
nek0 2016-07-11 18:34:39 +02:00
parent 5866ea8518
commit 9d5b140a05

View file

@ -102,6 +102,7 @@ putIndexES input = do
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "user") _ <- runBH' $ openIndex (IndexName "user")
runBH' $ indexDocument (IndexName "user") (MappingName "user") defaultIndexDocumentSettings user (DocId $ extractKey uId) runBH' $ indexDocument (IndexName "user") (MappingName "user") defaultIndexDocumentSettings user (DocId $ extractKey uId)
_ <- runBH' $ refreshIndex $ IndexName "user"
ESAlbum aId album -> do ESAlbum aId album -> do
ex <- runBH' $ indexExists (IndexName "album") ex <- runBH' $ indexExists (IndexName "album")
unless ex ((\ _ -> do unless ex ((\ _ -> do
@ -110,6 +111,7 @@ putIndexES input = do
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "album") _ <- runBH' $ openIndex (IndexName "album")
runBH' $ indexDocument (IndexName "album") (MappingName "album") defaultIndexDocumentSettings album (DocId $ extractKey aId) runBH' $ indexDocument (IndexName "album") (MappingName "album") defaultIndexDocumentSettings album (DocId $ extractKey aId)
_ <- runBH' $ refreshIndex $ IndexName "album"
ESMedium mId medium -> do ESMedium mId medium -> do
ex <- runBH' $ indexExists (IndexName "medium") ex <- runBH' $ indexExists (IndexName "medium")
unless ex ((\ _ -> do unless ex ((\ _ -> do
@ -118,6 +120,7 @@ putIndexES input = do
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "medium") _ <- runBH' $ openIndex (IndexName "medium")
runBH' $ indexDocument (IndexName "medium") (MappingName "medium") defaultIndexDocumentSettings medium (DocId $ extractKey mId) runBH' $ indexDocument (IndexName "medium") (MappingName "medium") defaultIndexDocumentSettings medium (DocId $ extractKey mId)
_ <- runBH' $ refreshIndex $ IndexName "medium"
ESComment cId comment -> do ESComment cId comment -> do
ex <- runBH' $ indexExists (IndexName "comment") ex <- runBH' $ indexExists (IndexName "comment")
unless ex ((\ _ -> do unless ex ((\ _ -> do
@ -126,6 +129,7 @@ putIndexES input = do
) ex) ) ex)
_ <- runBH' $ openIndex (IndexName "comment") _ <- runBH' $ openIndex (IndexName "comment")
runBH' $ indexDocument (IndexName "comment") (MappingName "comment") defaultIndexDocumentSettings comment (DocId $ extractKey cId) runBH' $ indexDocument (IndexName "comment") (MappingName "comment") defaultIndexDocumentSettings comment (DocId $ extractKey cId)
_ <- runBH' $ refreshIndex $ IndexName "comment"
case statusCode (responseStatus resp) of case statusCode (responseStatus resp) of
201 -> return () 201 -> return ()
200 -> return () 200 -> return ()