@@ -1314,8 +1314,9 @@ main = hspec $ do
1314 reply <- searchByIndex testIndex search
1314 reply <- searchByIndex testIndex search
1315 let result = decode (responseBody reply) :: Maybe (SearchResult Tweet)
1315 let result = decode (responseBody reply) :: Maybe (SearchResult Tweet)
1316 usersAggResults = result >>= aggregations >>= toTerms "users"
1316 usersAggResults = result >>= aggregations >>= toTerms "users"
1317− subAddResultsExists = maybe (Left False) Right $ ((isJust . termsAggs . head . buckets) <$> usersAggResults)
1317+ subAggResults = usersAggResults >>= (listToMaybe . buckets) >>= termsAggs >>= toTerms "age_agg"
1318+ subAddResultsExists = isJust subAggResults
1318− liftIO $ (subAddResultsExists) `shouldBe` Right True
1319+ liftIO $ (subAddResultsExists) `shouldBe` True
1320 it "returns cardinality aggregation results" $ withTestEnv $ do
1321 it "returns cardinality aggregation results" $ withTestEnv $ do
1321 _ <- insertData
1322 _ <- insertData