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

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..

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" -H 'Content-Type: application/json'

1 Like

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?

Yes, No problems

1 Like

Ok.thanks..i will try

1 Like

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