elasticsearch "illegal_argument_exception" 에러

Mingtorr·2021년 4월 25일
0

error code

"error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
  },
  "status" : 400

해결방법
1. 타입 중 string을 삭제하고 text로 변경
elastic search 6.X 부터 mapping 타입 중 string을 삭제하고 text로 변경하여 사용하고 있다고 합니다. 따라서 mapping의 타입 중 string으로 작성된 내용을 text로 변경해야 합니다.

  1. 헤더에 명시적으로 include_type_name 표기하기
    요청 헤더를 아래와 같이 표기하여 쿼리를 요청하면 정상적으로 인식했습니다.
curl -XPUT localhost:9200/classes/class/_mapping?include_type_name=true -d @classesRating_mapping.json -H 'Content-Type: application/json'

관련 정보 링크
https://stackoverflow.com/questions/47452770/no-handler-for-type-string-declared-on-field-name

https://www.elastic.co/kr/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0

https://www.inflearn.com/questions/12385

profile
츄르 값 벌기 위해 코딩하는 아키텍쳐

0개의 댓글