Client.create error on elastic:5.0.0-rc1
See original GitHub issueA simple:
client.create({ index: index_name, type: doc_type, timestamp: elem.date, body: elem },function (error_els, response) { [..] })
returns the following error is the post is done to Elastic:5.0.0-rc1: Validation Failed: 1: an id must be provided if version type or value are set
The condition in elastic that is being hit is the following:
https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/action/index/IndexRequest.java
if (id == null && (versionType == VersionType.INTERNAL && version == Versions.MATCH_ANY) == false) { validationException = addValidationError("an id must be provided if version type or value are set", validationException); }
My objective is to do a POST so that the id is automatically generated by elastic. The call works fine till elastic:5.0.0-alpha5
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
here you are: https://gist.github.com/fcrisciani/85da15fc79d1212d9623cd38b2dc1dd6
Just ran into this myself. I think the docs for
create
could use a link to theindex
method to clarify this behavior. I was used to the curlPUT
andPOST
behavior and IMOcreate
seemed to be the most idiomatic way to express creating a document/index (with or without an id).Docs for
create
.