git.iko.soy/typeable/bloodhound
on master help sign in
bulk create encoding
087ecbcAndrew Martin
src/Database/V5/Bloodhound/Client.hs+6
@@ -885,6 +885,12 @@ encodeBulkOperation (BulkUpdate (IndexName indexName)
885 doc = object ["doc" .= value]
885 doc = object ["doc" .= value]
886 blob = encode metadata `mappend` "\n" `mappend` encode doc
886 blob = encode metadata `mappend` "\n" `mappend` encode doc
887
887
888+encodeBulkOperation (BulkCreateEncoding (IndexName indexName)
889+ (MappingName mappingName)
890+ (DocId docId) encoding) = toLazyByteString blob
891+ where metadata = toEncoding (mkBulkStreamValue "create" indexName mappingName docId)
892+ blob = fromEncoding metadata <> "\n" <> fromEncoding encoding
893+
888-- | 'getDocument' is a straight-forward way to fetch a single document from
894-- | 'getDocument' is a straight-forward way to fetch a single document from
889-- Elasticsearch using a 'Server', 'IndexName', 'MappingName', and a 'DocId'.
895-- Elasticsearch using a 'Server', 'IndexName', 'MappingName', and a 'DocId'.
890-- The 'DocId' is the primary key for your Elasticsearch document.
896-- The 'DocId' is the primary key for your Elasticsearch document.
src/Database/V5/Bloodhound/Types.hs+2−1
@@ -710,8 +710,9 @@ data Mapping = Mapping { typeName :: TypeName
710data BulkOperation =
710data BulkOperation =
711 BulkIndex IndexName MappingName DocId Value
711 BulkIndex IndexName MappingName DocId Value
712 | BulkCreate IndexName MappingName DocId Value
712 | BulkCreate IndexName MappingName DocId Value
713+ | BulkCreateEncoding IndexName MappingName DocId Encoding
713 | BulkDelete IndexName MappingName DocId
714 | BulkDelete IndexName MappingName DocId
714− | BulkUpdate IndexName MappingName DocId Value deriving (Eq, Read, Show, Generic, Typeable)
715+ | BulkUpdate IndexName MappingName DocId Value deriving (Eq, Show, Generic, Typeable)
715
716
716{-| 'EsResult' describes the standard wrapper JSON document that you see in
717{-| 'EsResult' describes the standard wrapper JSON document that you see in
717 successful Elasticsearch lookups or lookups that couldn't find the document.
718 successful Elasticsearch lookups or lookups that couldn't find the document.