npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

AWS-ES-CURL fails with status 400

Hello all,

I have been trying to get it work like it is described here and managed to perform a GET request to the ElastiSearch endpoint in AWS. I set my credenatials as env variables and I am able to authenticate.So far it is perfect!

Unfortunately when I try to do a POST request looks like aws-es-curl does not see json file which include the body. Here are details:

  1. npm --version 3.5.2
  2. nodejs --version v8.10.0
  3. I created a test.json file with the body information inside and ran the following command -->
    aws-es-curl --region myregion -X POST ElasticSearchEndpoint/_bulk --data-binary @test.json -H ‘Content-Type: application/json’

And I got following error -->

{“error”:{“root_cause”:[{“type”:“parse_exception”,“reason”:“request body is required”}],“type”:“parse_exception”,“reason”:“request body is required”},“status”:400}

Looks like aws-es-curl does not see the json file… :frowning:

Could you please help me if I am missing something or point me how to use parse json file with the request ?

Cheers and thanks,

Hello again,

I found the solution . aws-es-curl must be used with “–data” only instead ot “–data-binary” :slight_smile: