Newline is missing when adding file in bulk API


I want to add the following line which is in a separate JSON file using the bulk API


I use the command

curl -XPOST -H 'Content-Type: application/json' localhost:9200/cheapest_offers/_bulk --data-binary Downloads/test/test.json

And get the error

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The bulk request must be terminated by a newline [\n]"}],"type":"illegal_argument_exception","reason":"The bulk request must be terminated by a newline [\n]"},"status":400}

PS: The file clearly contains an empty line at the end!

Can anyone explain this?

(David Pilato) #2

Could you share your file here?


what is the best way to do that? sorry I'm new to this site

(David Pilato) #4

Copy the full content as it is to
Or share it on whatever sharing binary site


(Christian Dahlqvist) #6

Is that the only line in your file? Where is the data you want to index? Have a look at the examples in the documentation. The only action that does not require data is a delete as far as I can remember.

(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.