# Elastic search Bulk Post testing

**URL:** <https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065>\
**Category:** Elasticsearch\
**Created:** [June 22, 2015, 9:23am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065 "2015-06-22T09:23:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gugansankar](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gugansankar](https://discuss.elastic.co/u/gugansankar)\
**Post date:** [June 22, 2015, 9:23am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065/1 "2015-06-22T09:23:48Z")

</div>

Getting below error when doing testing on my local environment. Please someone help me where I did the mistake.

curl -XPOST 'localhost:9014/customer/external/\_bulk?pretty' -d '  
{"index":{{"\_id":"15"}}  
{"account\_number":995,"balance":21153,"firstname":"Phelps","lastname":"Parrish","age":25,"gender":"M","address":"666 Miller [Place","employer":"Pearlessa","email":"phelpsparrish@pearlessa.com](mailto:Place%22,%22employer%22:%22Pearlessa%22,%22email%22:%22phelpsparrish@pearlessa.com)","city":"Brecon","state":"ME"}'  
{  
"error" : "JsonParseException[Unexpected character ('{' (code 123)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name\n at [Source: [B@543fb89e; line: 1, column: 12]]",  
"status" : 500  
}

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [June 22, 2015, 9:33am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065/2 "2015-06-22T09:33:32Z")

</div>

> [@gugansankar](#):
>
> {"index":{{"\_id":"15"}}

This error is becuase the request contains invalid JSON. Remove the extra `{` before `"_id"` and the error should be resolved.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 22, 2015, 9:36am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065/3 "2015-06-22T09:36:00Z")

</div>

Adding to this that you MUST add a line return after last bulk.

---

<div class="post-metadata">

**Author:** ![gugansankar](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gugansankar](https://discuss.elastic.co/u/gugansankar)\
**Post date:** [June 22, 2015, 9:40am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065/4 "2015-06-22T09:40:38Z")

</div>

Please give some example from the above data. As I tried by removing { from the command, now it failed with Validation. Then I checked with json-validator, it show some error with same { brace.

I just downloaded the json that mentioned on the elastic document page.

current error :

curl -XPOST 'localhost:9014/customer/external/\_bulk?pretty' -d '  
{"index":{"\_id":"15"}}  
{"account\_number":995,"balance":21153,"firstname":"Phelps","lastname":"Parrish","age":25,"gender":"M","address":"666 Miller [Place","employer":"Pearlessa","email":"phelpsparrish@pearlessa.com](mailto:Place%22,%22employer%22:%22Pearlessa%22,%22email%22:%22phelpsparrish@pearlessa.com)","city":"Brecon","state":"ME"}'  
{  
"error" : "ActionRequestValidationException[Validation Failed: 1: no requests added;]",  
"status" : 400  
}

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [June 22, 2015, 10:00am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065/5 "2015-06-22T10:00:03Z")

</div>

You need to add a new line to the end of the request as mentioned by @dadoonet.

```auto
curl -XPOST 'localhost:9014/customer/external/_bulk?pretty' -d '
{"index":{"_id":"15"}}
{"account_number":995,"balance":21153,"firstname":"Phelps","lastname":"Parrish","age":25,"gender":"M","address":"666 Miller Place","employer":"Pearlessa","email":"phelpsparrish@pearlessa.com","city":"Brecon","state":"ME"}
'

```

---

<div class="post-metadata">

**Author:** ![gugansankar](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@gugansankar](https://discuss.elastic.co/u/gugansankar)\
**Post date:** [June 22, 2015, 10:06am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065/6 "2015-06-22T10:06:51Z")

</div>

Great ! Thank You . Its worked. 😄

---

<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 6, 2017, 12:06am UTC](https://discuss.elastic.co/t/elastic-search-bulk-post-testing/24065/7 "2017-07-06T00:06:13Z")

</div>


