티스토리 뷰

반응형

Mappig 정보를 완벽(?)하게 입력을 했는데, 원인모를 오류가 발생했다.

 

"The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."

 

 

도대체, 아무리 소스를 뒤져봐도 잘못한게 없는뎅??

 

그래서, 다시 메뉴얼을 읽어보니 버전이 업그레이드 되면서 바뀌 부분에 대한 내용이 식별되었다.

 

Mapping types are no longer supported in versions 7.x. Elasticsearch 7.x Specifying types in requests is deprecated. For instance, indexing a document no longer requires a document type. The new index APIs are PUT {index}/_doc/{id} in case of explicit ids and POST {index}/_doc for auto-generated ids. Note that in 7.0, _doc is a permanent part of the path, and represents the endpoint name rather than the document type. The include_type_name parameter in the index creation, index template, and mapping APIs will default to false. Setting the parameter at all will result in a deprecation warning. The default mapping type is removed. My suggestion is to remove _doc type from your mappings. { "mappings": { "properties": { "category" : { "type": "nested", "properties" : {

7.x부터는 Indicies는 type을 1개만 사용하기 때문에 기존과 같이 type을 기술할 필요가 없어진 것이다!

 

 

아래와 같이 "_doc"라는 type명을 제거해 주고

 

다시 실행해 보면.. 성공~

 

알고나면 쉬운데, 변화가 진행중인 Elasticsearch라서.. 변화를 따라가기가 힘든 것도 사실인듯.

반응형

'IT > Elasticsearch' 카테고리의 다른 글

data type: text  (0) 2021.10.03
data type: keyword  (0) 2021.10.03
Mapping 중요성  (0) 2021.10.02
문서관리 API  (0) 2021.10.02
Node  (0) 2021.10.02