# Bulk API Failing

**URL:** <https://discuss.elastic.co/t/bulk-api-failing/308184>\
**Category:** Elasticsearch\
**Created:** [June 26, 2022, 1:04pm UTC](https://discuss.elastic.co/t/bulk-api-failing/308184 "2022-06-26T13:04:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandramouli\_ravi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandramouli_ravi/32/107222_2.png) [@chandramouli\_ravi](https://discuss.elastic.co/u/chandramouli_ravi)\
**Post date:** [June 26, 2022, 1:04pm UTC](https://discuss.elastic.co/t/bulk-api-failing/308184/1 "2022-06-26T13:04:03Z")

</div>

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](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

```auto
"{ \"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

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 26, 2022, 1:49pm UTC](https://discuss.elastic.co/t/bulk-api-failing/308184/2 "2022-06-26T13:49:54Z")

</div>

> [@chandramouli\_ravi](#):
>
> "{ "index" : { "\_index" : "customer", "\_id" : "1" } }  
> { "name" : "mouli" }"

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html#bulk-curl).

Try to use:

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

```

---

<div class="post-metadata">

**Author:** ![chandramouli\_ravi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandramouli_ravi/32/107222_2.png) [@chandramouli\_ravi](https://discuss.elastic.co/u/chandramouli_ravi)\
**Post date:** [June 26, 2022, 2:45pm UTC](https://discuss.elastic.co/t/bulk-api-failing/308184/3 "2022-06-26T14:45:55Z")

</div>

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

```auto
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" }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 24, 2022, 2:46pm UTC](https://discuss.elastic.co/t/bulk-api-failing/308184/4 "2022-07-24T14:46:15Z")

</div>

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