# I can not use ES-REST to bulk api

**URL:** <https://discuss.elastic.co/t/i-can-not-use-es-rest-to-bulk-api/71824>\
**Category:** Elasticsearch\
**Created:** [January 17, 2017, 7:52am UTC](https://discuss.elastic.co/t/i-can-not-use-es-rest-to-bulk-api/71824 "2017-01-17T07:52:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![2010](https://avatars.discourse-cdn.com/v4/letter/2/71c47a/32.png) [@2010](https://discuss.elastic.co/u/2010)\
**Post date:** [January 17, 2017, 7:52am UTC](https://discuss.elastic.co/t/i-can-not-use-es-rest-to-bulk-api/71824/1 "2017-01-17T07:52:21Z")

</div>

My Code:  
.......  
HttpEntity httpEntity = new NStringEntity("{'index':{'\_id':40}} {'name':'lala'}");  
Response response = restClient.performRequest(HttpMethod.POST.getName(), "/my\_index/product/\_bulk", Collections.\<String, String\>emptyMap(), httpEntity);

Throw exception:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/3/3ef6100213b6a71ba0f0d84341c9cbcc041df953.png)

---

<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:** [February 14, 2017, 7:52am UTC](https://discuss.elastic.co/t/i-can-not-use-es-rest-to-bulk-api/71824/2 "2017-02-14T07:52:29Z")

</div>

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