@@ -18,6 +18,7 @@ import Test.Import
1818
1919import Prelude
2020
21+import qualified Data.Aeson as Aeson
2122import qualified Test.Aggregation as Aggregation
2223import qualified Test.BulkAPI as Bulk
2324import qualified Test.Documents as Documents
@@ -117,3 +118,19 @@ main = hspec $ do
117118 regular_search `shouldBe` Right exampleTweet -- Check that the size restrtiction is being honored
118119 liftIO $
119120 scan_search `shouldMatchList` [Just exampleTweet, Just otherTweet]
121+
122+ describe "Search After API" $
123+ it "returns document for search after query" $ withTestEnv $ do
124+ _ <- insertData
125+ _ <- insertOther
126+ let
127+ sortSpec = DefaultSortSpec $ mkSort (FieldName "user") Ascending
128+ searchAfterKey = [Aeson.toJSON ("bitemyapp" :: String)]
129+ search = Search Nothing
130+ Nothing (Just [sortSpec]) Nothing Nothing
131+ False (From 0) (Size 10) SearchTypeQueryThenFetch (Just searchAfterKey)
132+ Nothing Nothing Nothing Nothing
133+ result <- searchTweets search
134+ let myTweet = grabFirst result
135+ liftIO $
136+ myTweet `shouldBe` Right otherTweet