Using the default install of aws-es-curl, and attempting to POST to /_bulk will result in the following 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 }
Modifying this line resolve(data.trim()); to remove the .trim() will get you past this error.
On my system, this file was located here after running npm install aws-es-curl -g
/opt/nvm/versions/node/v10.16.0/lib/node_modules/aws-es-curl/index.js
The command used was
cat stats.json | aws-es-curl -X POST "https://search-redacted.es.amazonaws.com/_bulk".
As bulk requests are multiple line, it would be nice to allow for the following:
aws-es-curl -X POST "https://search-redacted.es.amazonaws.com/_bulk" --data @stats.json
Using the default install of aws-es-curl, and attempting to POST to /_bulk will result in the following 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 }Modifying this line
resolve(data.trim());to remove the.trim()will get you past this error.On my system, this file was located here after running
npm install aws-es-curl -g/opt/nvm/versions/node/v10.16.0/lib/node_modules/aws-es-curl/index.jsThe command used was
cat stats.json | aws-es-curl -X POST "https://search-redacted.es.amazonaws.com/_bulk".As bulk requests are multiple line, it would be nice to allow for the following:
aws-es-curl -X POST "https://search-redacted.es.amazonaws.com/_bulk" --data @stats.json