Comments (5)
Your design for Version
sounds good to me.
I agree IndexDocumentSettings
rather than a separate function is probably the way to go.
For handling conflicts, we're talking about either a proper error or exception. Documentation on how to catch it is probably sufficient. Is it worth trying to parse out the new version number or is it mostly not going to matter and they just need to know it failed and to see the error body?
from bloodhound.
So I decided to actually try this out while writing tests for my change and I'm pretty sure ES is just putting some Java exception through a serializer. It would be awesome if we could parse out the exact version and stuff, but it looks like doing so would require us to parse an Error message which makes my skin crawl. For reference, here's the reply:
Response {responseStatus = Status {statusCode = 409, statusMessage = "Conflict"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Type","application/json; charset=UTF-8"),("Content-Length","144")], responseBody = "{\"error\":\"VersionConflictEngineException[[bloodhound-tests-twitter-1][2] [tweet][1]: version conflict, current [1], provided [1]]\",\"status\":409}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
What would be a nice compromise though is I could look through the API conventions documentation and provide to start with:
isVersionConflict :: Reply -> Bool
isVersionConflict = (== 409) . statusCode . responseStatus
With more to come later.
from bloodhound.
Pushed a commit that implements this. Added a simple test case that writes a value with a version control strategy that requires the value to increment, fails to increment it and asserts that the index is rejected with a version conflict. Have a look and let me know what you think.
from bloodhound.
@MichaelXavier other than my comment about the query appending, your commit looks good to me. Good tests, thank you! 👍
from bloodhound.
I believe this is resolved and generally available now. Thank you @MichaelXavier ! 🐻 👍
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.