Got error "The bulk request must be terminated by a newline [\\n]" when importing data with curl and insomnia

Hello,

after several attempts to integrate my data which are in json form via Curl and even insomnia

I always get the same error : "The bulk request must be terminated by a newline [\n]"

but even after adding a newline at the end of my file, I still get the error.

Does anyone have a clue how to fix this problem?

I specify that I use ELK 8.5.3 and that it is a Docker environment

Here is the Json that I use:

Here is the command that i use :

curl -s -XPOST "http://localhost:9200/_bulk?pretty" -H "Content-Type: application/x-ndjson" --data-binary @test2.json

Thank you for your time and your help.

That JSON file is not a valid bulk request payload. Have a look at the docs for an example of valid payload. If you are indexing a single document, do not use the bulk API.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.