1. 개요
재판 : https://blog.csdn.net/u014646662/article/details/94718834
ElasticSearch 7.x는 더 이상 기본적으로 지정된 인덱스 유형을 지원하지 않으며 elasticsearch 7.x에서 실행됩니다.
put es_test
{
"settings":{
"number_of_shards" : 3,
"number_of_replicas" : 0
},
"mappings":{
"books":{
"properties":{
"title":{
"type":"text"},
"name":{
"type":"text","index":false},
"publish_date":{
"type":"date","index":false},
"price":{
"type":"double"},
"number":{
"type":"object",
"dynamic":true
}
}
}
}
}
실행 결과가 잘못됩니다.Root mapping definition has unsupported parameters
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [books : {properties={number={dynamic=true, type=object}, price={type=double}, name={index=false, type=text}, title={type=text}, publish_date={index=false, type=date}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [books : {properties={number={dynamic=true, type=object}, price={type=double}, name={index=false, type=text}, title={type=text}, publish_date={index=false, type=date}}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [books : {properties={number={dynamic=true, type=object}, price={type=double}, name={index=false, type=text}, title={type=text}, publish_date={index=false, type=date}}}]"
}
},
"status": 400
}
6.x에서 실행하면 정상적으로 실행됩니다.
{
"acknowledged" : true
}
그 이유는 elasticsearch7이 기본적으로 지정된 인덱스 유형을 지원하지 않기 때문입니다. 기본 인덱스 유형은 _doc입니다. 변경을 원할 경우 include_type_name : true를 구성 할 수 있습니다. , elasticsearch8이이 필드를 제공하지 않기 때문에). 공식 문서 : https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html
따라서 Elasticsearch7에서 다음과 같은 인덱스를 생성해야합니다.
put /test
{
"settings":{
"number_of_shards":3,
"number_of_replicas":2
},
"mappings":{
"properties":{
"id":{
"type":"long"},
"name":{
"type":"text","analyzer":"ik_smart"},
"text":{
"type":"text","analyzer":"ik_max_word"}
}
}
}
put /test1
{
"settings":{
"number_of_shards":3,
"number_of_replicas":2
},
"mappings":{
"properties":{
"id":{
"type":"long"},
"name":{
"type":"text"},
"text":{
"type":"text"}
}
}
}