请求地址:put http://127.0.0.1:9200/test
,请求内容如下:
{
"settings": {
"analysis": {
"analyzer": {
"comma": {
"type": "pattern",
"pattern":","
}
}
}
},
"mappings": {
"doc":{
"properties": {
"text":{
"type": "text",
"analyzer": "comma"
}
}
}
}
}
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [doc : {properties={id={index=false, store=true, type=long}, title={analyzer=standard, index=true, store=true, type=text}, content={analyzer=standard, index=true, store=true, type=text}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [article : {properties={id={index=false, store=true, type=long}, title={analyzer=standard, index=true, store=true, type=text}, content={analyzer=standard, index=true, store=true, type=text}}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [article : {properties={id={index=false, store=true, type=long}, title={analyzer=standard, index=true, store=true, type=text}, content={analyzer=standard, index=true, store=true, type=text}}}]"
}
},
"status": 400
}
ElasticSearch7.x
默认不再支持指定索引类型,默认索引类型是_doc
,如果想改变,则配置 include_type_name: true
即可。注意这一字段将在 8.x
舍弃:
请求隐含:
include_type_name=false
官方原文:https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html
_doc,请求参数修改如下:
{
"settings": {
"analysis": {
"analyzer": {
"comma": {
"type": "pattern",
"pattern":","
}
}
}
},
"mappings": {
"properties": {
"my_text":{
"type": "text",
"analyzer": "comma"
}
}
}
}
2.如果你要像之前旧版一样兼容自定义 type
,需要携带参数 include_type_name=true
,演示图如下: