Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

ElasticSearch Error – Content-Type header [application/x-www-form-urlencoded] is not supported

elasticsearch-error-content-type-header

To fix this, add curl option -H ‘Content-Type: application/json’. This error is due to strict content-type checking introduced in ElasticSearch 6.0

curl -XPUT 'localhost:9200/products/mobiles/1?pretty' -d'
{
  "name": "iPhone 7",
  "camera": "12MP",
  "storage": "256GB",
  "display": "4.7inch",
  "battery": "1,960mAh",
  "reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"]
}
'
Response
{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406
}

Solution

curl -XPUT 'localhost:9200/products/mobiles/1?pretty' -H 'Content-Type: application/json' -d'
{
  "name": "iPhone 7",
  "camera": "12MP",
  "storage": "256GB",
  "display": "4.7inch",
  "battery": "1,960mAh",
  "reviews": ["Incredibly happy after having used it for one week", "Best iPhone so far", "Very expensive, stick to Android"]
}
'
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x