• 카테고리

    질문 & 답변
  • 세부 분야

    데이터 엔지니어링

  • 해결 여부

    미해결

현재 7버전 이용중인데 -XPOST 시 에러가 발생합니다.

19.06.26 11:04 작성 조회수 389

9

curl -XPOSt http://localhost:9200/classes/class/1/ -d '{"title" : "Algorithm", "professor" : "John"}' 입력 시 www-form-urlencoded is not supported status 406 에러가 발생합니다. 높은 버전에선 -H 'Content-Type: application/json' 을 추가해줘야 할듯합니다.

답변 3

·

답변을 작성해보세요.

5

Jong-pil Park님의 프로필

Jong-pil Park

2019.07.07

저도 동일한 문제를 겪었는데, ES6.0 이후 부터 content-type을 정확히 기재해주어야 한다고 합니다.

https://www.elastic.co/kr/blog/strict-content-type-checking-for-elasticsearch-rest-requests

Starting from Elasticsearch 6.0, all REST requests that include a body must also provide the correct content-type for that body.

 

또한, bulk 인 경우는  -H 'Content-Type: application/x-ndjson' 옵션을 추가해서 해결하였습니다.

이 경우, 개행까지가 반드시 포함되는게 ndjson의 스펙인가 봅니다. 일부 dump 파일의 마지막 줄 개행이 없으면

에러가 나는 것을 확인하고 수정하였습니다.

 

2016년 자료라 일부 커멘드와 데이터를 수정하면서 이것저것 찾아보는 것도 나쁘지 않네요.

본 강의로 ELK의 개념을 잡는데 큰 도움이 되었습니다. 감사합니다.

 

 

2

seeremarksay님의 프로필

seeremarksay

2022.02.24

curl -XPOST http://localhost:9200/classes/class/1/ -d'

{"title":"alal","professor":"john"}

' -H'Content-Type: application/json'

1

박세준님의 프로필

박세준

2023.09.15

8버전부터는 아래처럼 하도록 변경됨
curl -XPOST localhost:9200/classes/_doc/ -d '{"title" : "ElasticSearch", "professor" : "MinsukHeo"}' -H 'Content-Type: application/json'