bulk create encoding

This commit is contained in:
Andrew Martin 2017-08-07 11:58:56 -04:00
parent e34d30285b
commit 087ecbc7ab
2 changed files with 8 additions and 1 deletions

View File

@ -885,6 +885,12 @@ encodeBulkOperation (BulkUpdate (IndexName indexName)
doc = object ["doc" .= value]
blob = encode metadata `mappend` "\n" `mappend` encode doc
encodeBulkOperation (BulkCreateEncoding (IndexName indexName)
(MappingName mappingName)
(DocId docId) encoding) = toLazyByteString blob
where metadata = toEncoding (mkBulkStreamValue "create" indexName mappingName docId)
blob = fromEncoding metadata <> "\n" <> fromEncoding encoding
-- | 'getDocument' is a straight-forward way to fetch a single document from
-- Elasticsearch using a 'Server', 'IndexName', 'MappingName', and a 'DocId'.
-- The 'DocId' is the primary key for your Elasticsearch document.

View File

@ -710,8 +710,9 @@ data Mapping = Mapping { typeName :: TypeName
data BulkOperation =
BulkIndex IndexName MappingName DocId Value
| BulkCreate IndexName MappingName DocId Value
| BulkCreateEncoding IndexName MappingName DocId Encoding
| BulkDelete IndexName MappingName DocId
| BulkUpdate IndexName MappingName DocId Value deriving (Eq, Read, Show, Generic, Typeable)
| BulkUpdate IndexName MappingName DocId Value deriving (Eq, Show, Generic, Typeable)
{-| 'EsResult' describes the standard wrapper JSON document that you see in
successful Elasticsearch lookups or lookups that couldn't find the document.