-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c.e.r.response/ok?
erroneously reports false when updating a document
#192
Comments
@MerelyAPseudonym please submit a PR? Here's the docs repo. |
@michaelklishin Sure! I was already looking into how to resolve the issue, although I'm not confident that it's a documentation problem per se—even if the user were warned about the limitation of If you do feel like a provisional update to the docs is still valuable, let me know and I'd be happy to make the changes and submit a PR. |
@MerelyAPseudonym your understanding is correct. |
Also, full disclosure: my hunch is that this issue is actually because the
|
@michaelklishin Oh, thanks for the confirmation! (I hadn't refreshed the page before writing my previous comment) |
Those are not design flaws but choices made by HTTP service clients. If you want to use an HTTP client directly, you don't need Elastisch. |
I disagree, but I'm not confident we're on the same page. I'd guess that a PR would be the most effective illustration of what I was talking about, so… consider the ball in my court? |
One simple question I'd like someone who claims abstracting HTTP API is a flaw to answer: how would you support an API that is nearly identical to the native client? If this is a bug then all abstractions are and everybody should use HTTP directly. Except that from my experience, nobody wants to, and this is why Elastisch is possibly the most widely adopted ClojureWerkz project. Anyhow, if you want to submit a PR for the docs, please do. I'm locking this issue. |
Part of the problem here is that ES has a pretty unfortunate way of indicating success/failure scenarios. I will try to cover more of them but it really should have been reflected in the HTTP response status first and foremost. Maybe it's something that's better in 5.0, in prior versions it's certainly a mess :( |
I switched to detecting the lack of failure when we don't have known indicators of success. Thank you, @MerelyAPseudonym, for providing a test case. |
Modern ES versions provide multiple "success indicators" in responses so we switch to looking for known indicators and if they are not there, fall back to detecting [the lack of] failures. Closes clojurewerkz#192.
Elastisch’s Getting Started and Indexing pages make it sound like
clojurewerkz.elastisch.rest.response/ok?
should always be used to determine if an Elasticsearch command succeeded, but it can give false negatives. Specifically, as the following REPL interactions demonstrate, it won't recognize a successful document update. I believe this is becausec.e.r.response/ok?
merely delegates toc.e.r.response/created?
but successful updates return"created": false
.Note that the returned document contains the updated value, indicating that the PUT did actually succeed.
The text was updated successfully, but these errors were encountered: