# Unable to fix "Content type detection for rest requests is deprecated. Specify the content type using the \[Content-Type\] header." in ES 5.6.1

**URL:** <https://discuss.elastic.co/t/unable-to-fix-content-type-detection-for-rest-requests-is-deprecated-specify-the-content-type-using-the-content-type-header-in-es-5-6-1/108404>\
**Category:** Elasticsearch\
**Created:** [November 20, 2017, 2:19pm UTC](https://discuss.elastic.co/t/unable-to-fix-content-type-detection-for-rest-requests-is-deprecated-specify-the-content-type-using-the-content-type-header-in-es-5-6-1/108404 "2017-11-20T14:19:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [November 20, 2017, 2:19pm UTC](https://discuss.elastic.co/t/unable-to-fix-content-type-detection-for-rest-requests-is-deprecated-specify-the-content-type-using-the-content-type-header-in-es-5-6-1/108404/1 "2017-11-20T14:19:19Z")

</div>

Hi ..I am using \_bulk for sending bulk requests to ES. When I run the code, I find the warning "Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header.Deprecated field [template] used, expected [source] instead" as response and later it says status="BadRequest" in the log..Is there a way to set Content-type header manually? Tried a lot...Not able to fix it..Please help..Thanks in advance

The following is a part of the log image

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/3/133ae8c448e26f455c87287df1a151b6dd325bff.png)

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [November 20, 2017, 8:29pm UTC](https://discuss.elastic.co/t/unable-to-fix-content-type-detection-for-rest-requests-is-deprecated-specify-the-content-type-using-the-content-type-header-in-es-5-6-1/108404/2 "2017-11-20T20:29:46Z")

</div>

> [@saii](#):
>
> Tried a lot...Not able to fix it

What have you tried?

You need to also send the Content-Type HTTP header with the request. For the [Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-bulk.html), the header should be

```auto
Content-Type: application/x-ndjson

```

---

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [November 29, 2017, 11:28am UTC](https://discuss.elastic.co/t/unable-to-fix-content-type-detection-for-rest-requests-is-deprecated-specify-the-content-type-using-the-content-type-header-in-es-5-6-1/108404/3 "2017-11-29T11:28:23Z")

</div>

Thanks for the reply..i have read the Bulk api doc attached...But am unable to change the content-type that is set..The content-type that is set is application/json.Can I set the Content-type to spplication/x-ndjson for Bulk API manually..Can it be done using curl command? Please suggest

---

<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:** [December 27, 2017, 11:28am UTC](https://discuss.elastic.co/t/unable-to-fix-content-type-detection-for-rest-requests-is-deprecated-specify-the-content-type-using-the-content-type-header-in-es-5-6-1/108404/4 "2017-12-27T11:28:57Z")

</div>

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