@@ -138,9 +138,12 @@ openIndex = openOrCloseIndexes OpenIndex
138closeIndex :: Server -> IndexName -> IO Reply
138closeIndex :: Server -> IndexName -> IO Reply
139closeIndex = openOrCloseIndexes CloseIndex
139closeIndex = openOrCloseIndexes CloseIndex
141+{-| putMapping is an HTTP PUT and has upsert semantics. Mappings are schemas
142+ for documents in indexes.
141−createMapping :: ToJSON a => Server -> IndexName
144+putMapping :: ToJSON a => Server -> IndexName
142 -> MappingName -> a -> IO Reply
145 -> MappingName -> a -> IO Reply
143−createMapping (Server server) (IndexName indexName) (MappingName mappingName) mapping =
146+putMapping (Server server) (IndexName indexName) (MappingName mappingName) mapping =
144 put url body
147 put url body
145 where url = joinPath [server, indexName, mappingName, "_mapping"]
148 where url = joinPath [server, indexName, mappingName, "_mapping"]
146 body = Just $ encode mapping
149 body = Just $ encode mapping
@@ -149,6 +152,7 @@ deleteMapping :: Server -> IndexName -> MappingName -> IO Reply
149deleteMapping (Server server) (IndexName indexName)
152deleteMapping (Server server) (IndexName indexName)
150 (MappingName mappingName) =
153 (MappingName mappingName) =
151 delete $ joinPath [server, indexName, mappingName, "_mapping"]
154 delete $ joinPath [server, indexName, mappingName, "_mapping"]
152indexDocument :: ToJSON doc => Server -> IndexName -> MappingName
156indexDocument :: ToJSON doc => Server -> IndexName -> MappingName
153 -> doc -> DocId -> IO Reply
157 -> doc -> DocId -> IO Reply
154indexDocument (Server server) (IndexName indexName)
158indexDocument (Server server) (IndexName indexName)