Bulk API Failing

Hi,

I am using ElasticSearch 8.2.3 version in Windows 10
I have tried modifying in multiple ways.. but its still failing
Could you please help.

curl --insecure -H "Content-Type: application/x-ndjson" -XPUT "https://elastic:password@172.20.192.1:9201/customer/_bulk?pretty" --data-binary "@bulk_input.json"

bulk_input.json Contents
"{ "index" : { "_index" : "customer", "_id" : "1" } }
{ "name" : "mouli" }"

I even tried changing file content to

"{ \"index\" : { \"_index\" : \"customer\", \"_id\" : \"1\" } } 
 { \"name\" : \"mouli\" }"

But getting this error
"type" : "illegal_argument_exception",
"reason" : "Malformed action/metadata line [1], expected START_OBJECT but found [VALUE_STRING]"

Thanks,
Chandra

This does not seems right, why do you have double quotes in the beginning and in the end? This is not needed, check the documentation example.

Try to use:

{ "index" : { "_index" : "customer", "_id" : "1" } }
{ "name" : "mouli" }

Thank you.. I have modified as you have suggested. Its working now.
Command and respective JSON File content is shared below.

curl --insecure -H "Content-Type: application/x-ndjson" -XPUT  "https://elastic:GfV=password@172.20.192.1:9201/customer/_bulk?pretty" --data-binary "@bulk_input.json"
{ "index" : { "_index" : "customer", "_id" : "1" } } 
 { "name" : "mouli" }
1 Like

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