I am trying to create index and upload data in elasticsearch using curl

Hello everyone !
I am trying to create new index with those data in Elasticsearch
I have big data in json format I save it in a file

and then I use

this curl

$ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary @weather_to_json.json

and I find this error

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


let's start small and reuse the same example as shown in the docs - just a single example with two lines.

Does this work?

Also, does the last line contain a newline in your custom file?


I get that error if the json file doesn't exist in the directory where I run the curl command or if I've misspelled the filename, so you may want to verify that you're in the same directory and that the filename is correctly spelled.

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