# How to set Content-type header to application/x-ndjson?

**URL:** <https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781>\
**Category:** Elasticsearch\
**Created:** [November 30, 2017, 3:30pm UTC](https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781 "2017-11-30T15:30:45Z")\
**Posts on this page:** 6\
**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 30, 2017, 3:30pm UTC](https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781/1 "2017-11-30T15:30:45Z")

</div>

Hi..I am using \_bulk for sending bulk requests to rest api..But 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. I read the documentation for Bulk api. It says i need to set content-type to application/x-ndjson. How can I change content-type header from application/json to application/x-ndjson? Can someone please suggest me ways to change the content-type?

Thanks in advance..

---

<div class="post-metadata">

**Author:** ![Fram\_Souza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fram_souza/32/24833_2.png) [@Fram\_Souza](https://discuss.elastic.co/u/Fram_Souza)\
**Post date:** [November 30, 2017, 4:10pm UTC](https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781/2 "2017-11-30T16:10:22Z")

</div>

Hi saii,

what version of ES are you using? In general, you can specify within the curl itself how to ensure:

**curl -XGET "[http://localhost:9200/\_cat/indices](http://localhost:9200/_cat/indices)" -H 'Content-Type: application/json'**

---

<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:** [December 2, 2017, 12:05pm UTC](https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781/3 "2017-12-02T12:05:13Z")

</div>

Thanks for the reply..ES version am using is 5.6.1

So,can I even set the content-type for Bulk requests using curl?

---

<div class="post-metadata">

**Author:** ![Fram\_Souza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fram_souza/32/24833_2.png) [@Fram\_Souza](https://discuss.elastic.co/u/Fram_Souza)\
**Post date:** [December 3, 2017, 1:05am UTC](https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781/4 "2017-12-03T01:05:25Z")

</div>

Yes, No problems

---

<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:** [December 5, 2017, 3:21pm UTC](https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781/5 "2017-12-05T15:21:45Z")

</div>

Ok.thanks..i will try

---

<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:** [January 2, 2018, 3:22pm UTC](https://discuss.elastic.co/t/how-to-set-content-type-header-to-application-x-ndjson/109781/6 "2018-01-02T15:22:12Z")

</div>

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