Search code examples
macoscurlelasticsearchelasticsearch-bulk

elastic search exception on bulk create


I want to test the bulk insert

this is my request

curl -PUT "http://localhost:9200/blabla/blabla/_bulk?pretty" -d '{
{"create": {}}\n
{"name" : "super"}\n
}' -i

I am getting this error:

HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 210

{
  "error" : "JsonParseException[Unexpected end-of-input: expected close marker for OBJECT (from [Source: [B@29ae00d4; line: 1, column: 0])\n at [Source: [B@29ae00d4; line: 1, column: 3]]",
  "status" : 500
}

I don't know why the error message states to close } i guess this is a correct JSON and i am adding the end of line as the official website asks for


Solution

  • That is the wrong sytax should not have parenthesis after -d it should be as follows:

     curl -PUT "http://localhost:9200/blabla/blabla/_bulk?pretty" -d '
    {"create": {}}\n
    {"name" : "super"}\n
    ' -i