Open Source/elastic
[에러] Content-Type header [application/x-www-form-urlencoded] is not supported
editor2080
2018. 2. 19. 17:59
* 아래와 같은 에러 발생 시
1 2 3 4 5 | { "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported", "status" : 406 } | cs |
* curl 명령어에 옵션을 다음과 같이 추가하여 실행합니다.
1 2 | -H 'Content-Type: application/json' | cs |
: 추가 전
1 2 3 4 5 6 7 8 9 10 | $ curl -XPUT master:9200/customer/external/1?pretty -d' > { > "name": "John Doe" > } > ' { "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported", "status" : 406 } | cs |
: 추가 후
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | $ curl -XPUT master:9200/customer/external/1?pretty -H'Content-Type: application/json' -d' > { > "name": "John Doe" > } > ' { "_index" : "customer", "_type" : "external", "_id" : "1", "_version" : 1, "result" : "created", "_shards" : { "total" : 2, "successful" : 2, "failed" : 0 }, "_seq_no" : 0, "_primary_term" : 1 } | cs |
* Elasticsearch 6.0 이후 버전에 도입된 엄격한 content-type 확인으로 인해서 추가해야 합니다.