ELK 뽀개기/ElasticSearch
[Elastic Search] Content-Type header [application/x-www-form-urlencoded] is not supported error
개발자가될수있을까?
2020. 8. 24. 14:47
엘라스틱 서치 5.x 버전부터 데이터를 넣을 때 헤더에 미디어 타입을 정해주어야합니다.
curl -XPOST "localhost:9200/blog/post/1?pretty=true"
-d "{""name"":""sangwon"",""posttitle"":""elastic search beginning""}"
기존 쿼리는
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
}
이러한 에러가 발생합니다.
curl -XPOST "localhost:9200/blog/post/1?pretty=true"
-d "{""name"":""sangwon"",""posttitle"":""elastic search beginning""}"
-H "Content-Type: application/json"
으로 데이터 뒤에 다음 문구를 추가해 줍시다.
-H "Content-Type: application/json"
끝