Comments (5)
So, there's a BulkOperation data type. That contains all the information required to generate a request.
From there, to get a ByteString you can use collapseStream to turn a list of BulkOperations into a ByteString.
https://github.com/bitemyapp/bloodhound/blob/master/Database/Bloodhound/Client.hs#L175-L179
All that happens after that is bulk POSTs the generated: https://github.com/bitemyapp/bloodhound/blob/master/Database/Bloodhound/Client.hs#L173
Do you want collapseStream to be exported? If so, I'd probably rename it to something more explicitly about bulk operations first.
from bloodhound.
collapseStream
is pretty close to what I'm looking for, because I would just need to construct my own data structure (maybe Network.HTTP.Base.Request
?) before sending it out. Even better would be a function which returns the data structure itself, so that the building of HTTP requests can be done separately from the sending. This isn't a critical feature, but I think it fits nicely into the concept of separating pure and impure code.
from bloodhound.
This isn't a critical feature, but I think it fits nicely into the concept of separating pure and impure code.
Yeah, that's fine.
Network.HTTP.Base.Request
That's specific to a library I'm not using. I'm not adding that as a dependency.
https://hackage.haskell.org/package/http-types-0.8.5/docs/Network-HTTP-Types.html
There are neutral component types for things like methods, but not the requests themselves for various reasons.
I'll expose collapseStream with a more specific name so you can turn the bulk operations into the bytestring blob that can be posted, there's really not much more information than that - method POST and the server you're POST'ing to.
from bloodhound.
Fixed by b911e9a
They're exported from the library as encodeBulkOperations
and encodeBulkOperation
. I added documentation as well.
I can't guarantee I'll push 0.4.0.0 to Hackage soon, but you can at least clone it and install for your builds immediately.
from bloodhound.
Awesome, thanks!
from bloodhound.
Related Issues (20)
- ES 6.4.2 HOT 9
- About Mappings HOT 2
- DocId needs url-encoding for certain operations HOT 7
- Docker Compose support so that full test runs can be spun up
- Re-unifying Bloodhound's implementation HOT 4
- Update to Elastic 7.x (currently 7.4)
- Support count API HOT 1
- Is it possible to use a later version of containers and http-client HOT 2
- Derive Mapping
- Support GHC 8.8 HOT 1
- Update docs at Hackage
- Latest version low upper cap HOT 2
- Build errors with `aeson-2.0.1.0` HOT 1
- In nix stable and unstable, bloodhound is tagged as "broken" HOT 4
- Search parameter `min_score` is not supported
- Library redesign HOT 1
- Not possible to build with http-client >= 0.7 HOT 2
- Add example that deserializes response from ES HOT 2
- `parseEsResponse` not able to parse a "document not found" response HOT 3
- No response type available for bulk operation result? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bloodhound.