Hello everybody,
First of all my setup:
- ES 5 (upgraded from 2.4)
- My node.js app is accessing ES using the JavaScript API
- documents IDs are autogenerated by elastic
When running ES 2.4 issuing a create
call such as:
client.create({
index: 'myindex',
type: 'mytype',
body: {
title: 'Test 1',
tags: ['y', 'z'],
published: true,
published_at: '2013-01-01',
counter: 1
}
}, function (error, response) {
// ...
});
would result, as expected, in the creation of a document.
Now, with ES 5.0, the same call results in this error:
{ "error": { "root_cause": [
{
"type":"action_request_validation_exception",
"reason":"Validation Failed: 1: an id must be provided if version type or value are set;"
}
],
"type":"action_request_validation_exception",
"reason":"Validation Failed: 1: an id must be provided if version type or value are set;"},
"status":400
}
The javascript call gets 'translated' into this REST call:
POST localhost:9200/examples/example?op_type=create
{
index: 'myindex',
type: 'mytype',
body: {
title: 'Test 1',
tags: ['y', 'z'],
published: true,
published_at: '2013-01-01',
counter: 1
}
}
If I remove the op_type=create
then everything is fine (note that in ES 2.4 the exact same REST call would result in the document being indexed, no problems)
I did not find anything in breaking changes mentioning something about the create API, but maybe I did not look hard enough into it.
Has anyone ran into this problem or can give me a hint or two how to solve this?
Thanks