Elasticsearch: Bulk request throws error in Elasticsearch 6.1.1
As the document says:
use the --data-binary
flag instead of plain -d
-d
doesn’t preserve newlines and doesn't format the json.
I faced this problem because of JSON formatting.
The error is pretty clear:
The bulk request must be terminated by a newline [\n]
So you simply need to add a newline at the end of your customers_full.json
file and you'll be ok.
Add empty line at the end of the JSON file and save the file and then try to run the below command
curl -XPOST localhost:9200/subscribers/ppl/_bulk?pretty --data-binary @customers_full.json -H 'Content-Type: application/json'