I'm a new learned and follow AWS example here: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-gsg-upload-data.html to build my first elasticsearch application.
I'm using Postman for curl command POST to append new document and index as shown here. However it seems the syntax is incorrect highlight by Postman so see if support to correct, thank you!
Asked
Active
Viewed 463 times
1

Michael C.H. Wang
- 97
- 1
- 10
-
Refer to this Stackoverflow https://stackoverflow.com/questions/45792309/bulk-api-malformed-action-metadata-line-3-expected-start-object-but-found ,so "_bulk" missed in the end of URL. – Michael C.H. Wang Jul 31 '18 at 14:41
1 Answers
1
If you're posting to the _bulk
URL, then the lines 1 through 6 should be on a single line without newlines. Same for lines 7 and 8. And you need to add a single newline at the end. Like this:
{ "index": {"_index": "movies", "_type": "movie", "_id": "2" }}
{ "director": "...", ...} + add a new line at the end of this line

Val
- 207,596
- 13
- 358
- 360
-
1Hi Val, I followed your suggestion but it seemed not working as below: – Michael C.H. Wang Jul 31 '18 at 03:57
-
What headers are you adding? You also need the following header: `Content-Type: application/x-ndjson` – Val Jul 31 '18 at 04:00
-
Hi Val, I also updated what has been shown on postman and these headers added, thank you if you can comment more. – Michael C.H. Wang Jul 31 '18 at 04:02
-
It seems you've added tabs in the actor array (see the red X), cant his be? If yes, you need to remove them. – Val Jul 31 '18 at 04:07
-
-
-
Simply say "Syntax error", that's why I put title of this question in this way, thank you. – Michael C.H. Wang Jul 31 '18 at 05:23
-
Paste your document [here](https://www.browserling.com/tools/remove-all-whitespace) and remove all white spaces. Then take the result and try again – Val Jul 31 '18 at 05:30
-
Can you update the question with the raw JSON, please? (not a screenshot, but actual JSON) – – Val Aug 10 '18 at 06:37