1{-# LANGUAGE OverloadedStrings #-}
3module Test.Script where
8import qualified Data.HashMap.Strict as HM
9import qualified Data.Map as M
14 it "returns a transformed document based on the script field" $ withTestEnv $ do
16 let query = MatchAllQuery Nothing
19 (Just (ScriptLanguage "painless"))
20 (Just (ScriptInline "doc['age'].value * 2"))
24 HM.fromList [("test1", sfv)]
25 search' = mkSearch (Just query) Nothing
26 search = search' { scriptFields = Just sf }
27 resp <- searchByIndex testIndex search
28 parsed <- parseEsResponse resp :: BH IO (Either EsError (SearchResult Value))
31 liftIO $ expectationFailure ("Expected a script-transformed result but got: " <> show e)
34 hitFields (head (hits (searchHits sr)))
36 results `shouldBe` HitFields (M.fromList [("test1", [Number 20000.0])])
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list