Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch "no requests added" Bulk API Error

Trying to get Bulk Update to work on ES 1.0.1.

I am within Postman posting the following:

URL POST or PUT to http://localhost:9200/_bulk

Request Body:

{ "update" : { "_index" : "test_people", "_type" : "person", "_id" : "1" }} \n { "doc" : { "name":"hi", "age":100 }} \n 

I have tried it with and without the \n. I always get

{     "error": "ActionRequestValidationException[Validation Failed: 1: no requests added;]",     "status": 500 } 

It also does the same thing on a create using the data:

{   "create": {     "_index": "test_people",     "_type": "person",     "_id": "1"   } } {   "name": "hi",   "age": 100 } 

Update

I have tried this on a Mac, PC, and Linux and I am continually getting the same error.

like image 465
Micah Avatar asked Apr 10 '14 18:04

Micah


2 Answers

Even though i had \n on the last line I literally HAD to have a full carriage return after my last json line.

The following worked:

{ "update" : { "_index" : "test_people", "_type" : "person", "_id" : "1" }} \n { "doc" : { "name":"hi", "age":100 }} 

So there needs to be an empty line below the "doc" line.

like image 176
Micah Avatar answered Sep 25 '22 21:09

Micah


True that one blank new line , after document row does the trick.

enter image description here

like image 20
prayagupa Avatar answered Sep 25 '22 21:09

prayagupa