I recently upgraded to Elasticsearch version 6.1.1 and now I can\'t bulk index documents from a JSON file. When I do it inline, it works fine. Here are the contents of the d
Add empty line at the end of the JSON file and save the file and then try to run the below command
curl -XPOST localhost:9200/subscribers/ppl/_bulk?pretty --data-binary @customers_full.json -H 'Content-Type: application/json'
I hope it works fine for you.
you just need to open json file and then go to the end of the file ( Ctrl+end) and then please Enter to break a new line.
This worked for me:
curl -H "Content-Type: application/x-ndjson" -XPOST "localhost:9200/bank/_bulk?pretty&refresh" --data-binary "@C:\Program Files\Elastic\Elasticsearch\7.2.0\accounts.json"
This worked in my local set-up.
curl -H "Content-type:application/json" -XPOST "http://localhost:9200/customer/personal/_bulk?pretty" --data-binary @"generated.json"
I had a similar issue when working with Elasticsearch 7.3.
Here's how I solved it.
.json
file, say products.json
file..json
file in your text editor..json
file and then press the ENTER key on your keyboard..json
file. This will create a new line at the end of .json
file.N/B: For the command below, the .json
file name is products.json
which I am importing to http://localhost:9200/ecommerce/product
curl -H "Content-type: application/json" -XPOST "http://localhost:9200/ecommerce/product/_bulk?pretty" --data-binary "@products.json"
That's all.
I hope this helps
You need to use --data-binary instead of -d in your curl request. Please see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html