I am using request.js to post data to the elasticsearch server. Indexing single document is working however I am not able to make bulk work.
I have a simple function that posts data to "localhost:9200/_bulk"
with var client setup already I use:
client.post('_bulk', data, function(err, res, body) {
console.log(err);
console.log(body);
back({
success: 1
});
});
And the data is created by stringifying objects for example:
data = JSON.stringify( {update:{_index:"myindex", _type:"users", _id: 23}} ) + "\n" + JSON.stringify( {doc: { blocked: 1 }} ) + "\n";
Using this I get an error:
{ error: 'ActionRequestValidationException[Validation Failed: 1: no requests added;]', status: 400 }