Newline is missing when adding file in bulk API


#1

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

{"index":{"_id":"53e23f5ae4b0ef99cb360835"}}

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?


#3

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 gist.github.com
Or share it on whatever sharing binary site


#5

(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.