-
Notifications
You must be signed in to change notification settings - Fork 603
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
[elasticsearch-api] Mismatch between documentation and behaviour in Elasticsearch::API::Actions#create #491
Comments
Right, there's some kind of mismatch. I can see that I've added that specific verification in the last commit, and the Elasticsearch's REST API specification lists the parameter as |
I've fixed the method in the attached commit and verified it manually against ES 6.x and master. Many thanks for bringing it to my attention, @janko-m! Verification
curl localhost:9250 | jq '.version.number'
|
Previously, the "Create" API has required the `:id` argument, although it is _not_ required [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#_automatic_id_generation]. The REST API specs list it as required, though: <https://github.com/elastic/elasticsearch/blob/b47b399f000fce42eac0e00b9fdcf969122660ab/rest-api-spec/src/main/resources/rest-api-spec/api/create.json#L11> This patch changes the logic of calling the `index` API method: when the `:id` is present, it adds the `op_type` parameter, if it's missing, it simply calls the `index` method with parameters "as is". Closes #491 (cherry picked from commit b1a8482)
I've merged the fix into the |
The documentation for
Elasticsearch::API::Actions#create
says for the:id
parameter:However, the
:id
parameter is actually required:elasticsearch-ruby/elasticsearch-api/lib/elasticsearch/api/actions/create.rb
Lines 29 to 32 in 698065a
So either the documentation needs to be corrected or the
:id
shouldn't be required. I'm hoping for the latter, asid
shouldn't be required by Elasticsearch when creating documents directly.The text was updated successfully, but these errors were encountered: