npm aws-es-curl

Hello support,

I’ve been trying to upload a json file using a rest call with aws-es-curl by performing following command
aws-es-curl --region myregion -X POST ElasticSearchEndpoint/_bulk --data @test.json -H ‘Content-Type: application/json’

In test.json file I have following details like described in official AWS documentation

{ “index” : { “_index”: “movies”, “_type” : “_doc”, “_id” : “2” } }
{“director”: “Frankenheimer, John”, “genre”: [“Drama”, “Mystery”, “Thriller”], “year”: 1962, “actor”: [“Lansbury, Angela”, “Sinatra, Frank”, “Leigh, Janet”, “Harvey, Laurence”, “Silva, Henry”, “Frees, Paul”, “Gregory, James”, “Bissell, Whit”, “McGiver, John”, “Parrish, Leslie”, “Edwards, James”, “Flowers, Bess”, “Dhiegh, Khigh”, “Payne, Julie”, “Kleeb, Helen”, “Gray, Joe”, “Nalder, Reggie”, “Stevens, Bert”, “Masters, Michael”, “Lowell, Tom”], “title”: “The Manchurian Candidate”}
{ “index” : { “_index”: “movies”, “_type” : “_doc”, “_id” : “3” } }
{“director”: “Baird, Stuart”, “genre”: [“Action”, “Crime”, “Thriller”], “year”: 1998, “actor”: [“Downey Jr., Robert”, “Jones, Tommy Lee”, “Snipes, Wesley”, “Pantoliano, Joe”, “Jacob, Ir\u00e8ne”, “Nelligan, Kate”, “Roebuck, Daniel”, “Malahide, Patrick”, “Richardson, LaTanya”, “Wood, Tom”, “Kosik, Thomas”, “Stellate, Nick”, “Minkoff, Robert”, “Brown, Spitfire”, “Foster, Reese”, “Spielbauer, Bruce”, “Mukherji, Kevin”, “Cray, Ed”, “Fordham, David”, “Jett, Charlie”], “title”: “U.S. Marshals”}
{ “index” : { “_index”: “movies”, “_type” : “_doc”, “_id” : “4” } }
{“director”: “Ray, Nicholas”, “genre”: [“Drama”, “Romance”], “year”: 1955, “actor”: [“Hopper, Dennis”, “Wood, Natalie”, “Dean, James”, “Mineo, Sal”, “Backus, Jim”, “Platt, Edward”, “Ray, Nicholas”, “Hopper, William”, “Allen, Corey”, “Birch, Paul”, “Hudson, Rochelle”, “Doran, Ann”, “Hicks, Chuck”, “Leigh, Nelson”, “Williams, Robert”, “Wessel, Dick”, “Bryar, Paul”, “Sessions, Almira”, “McMahon, David”, “Peters Jr., House”], “title”: “Rebel Without a Cause”}

https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.html

And aws-es-curl always fails with
{“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}

I have tried everything and formatted the file with new line but it did not help :frowning:

But If I use standard cURL it works perfectly and I got 201 and my data is uploaded to ES
curl -XPOST ElasticSearchEndpoint/_bulk --data-binary @test.json -H ‘Content-Type: application/json’

Could you please help so probably aws-es-curl accepts some more specific data structure ?

Cheers and I appreciate you help.
radik

(You might get an answer here, but because this forum is focused on npm, you might want to ask your question somewhere that targets experts with aws-es-curl. I have moved your topic to #community:javascript)