@@ -177,15 +177,32 @@ data ParentMapping = ParentMapping deriving (Eq, Show)
177177
178178instance ToJSON ParentMapping where
179179 toJSON ParentMapping =
180− object ["parent" .= Null ]
180+ object ["parent" .=
181+ object ["properties" .=
182+ object [ "user" .= object ["type" .= ("string" :: Text)]
183+ -- Serializing the date as a date is breaking other tests, mysteriously.
184+ -- , "postDate" .= object [ "type" .= ("date" :: Text)
185+ -- , "format" .= ("YYYY-MM-dd`T`HH:mm:ss.SSSZZ" :: Text)]
186+ , "message" .= object ["type" .= ("string" :: Text)]
187+ , "age" .= object ["type" .= ("integer" :: Text)]
188+ , "location" .= object ["type" .= ("geo_point" :: Text)]
189+ ]]]
181190
182191data ChildMapping = ChildMapping deriving (Eq, Show)
183192
184193instance ToJSON ChildMapping where
185194 toJSON ChildMapping =
186195 object ["child" .=
187− object ["_parent" .= object ["type" .= ("parent" :: Text)]]
188− ]
196+ object ["_parent" .= object ["type" .= ("parent" :: Text)]
197+ , "properties" .=
198+ object [ "user" .= object ["type" .= ("string" :: Text)]
199+ -- Serializing the date as a date is breaking other tests, mysteriously.
200+ -- , "postDate" .= object [ "type" .= ("date" :: Text)
201+ -- , "format" .= ("YYYY-MM-dd`T`HH:mm:ss.SSSZZ" :: Text)]
202+ , "message" .= object ["type" .= ("string" :: Text)]
203+ , "age" .= object ["type" .= ("integer" :: Text)]
204+ , "location" .= object ["type" .= ("geo_point" :: Text)]
205+ ]]]
189206
190207data TweetMapping = TweetMapping deriving (Eq, Show)
191208
@@ -932,8 +949,8 @@ main = hspec $ do
932949
933950 it "indexes two documents in a parent/child relationship and checks that the child exists" $ withTestEnv $ do
934951 resetIndex
935− _ <- putMapping testIndex (MappingName "parent") ParentMapping
936952 _ <- putMapping testIndex (MappingName "child") ChildMapping
953+ _ <- putMapping testIndex (MappingName "parent") ParentMapping
937954 _ <- indexDocument testIndex (MappingName "parent") defaultIndexDocumentSettings exampleTweet (DocId "1")
938955 let parent = (Just . DocumentParent . DocId) "1"
939956 ids = IndexDocumentSettings NoVersionControl parent