智者不为愚者谋,勇者不为怯者死。这篇文章主要讲述Elasticsearch7学习笔记之_doc类型被取消相关的知识,希望能为你提供帮助。
ES7 _doc报错
0x00 概述在使用ES7设置mapping的时候,发现报错如下:
The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true
0x00 问题复现
PUT my_index
"settings":
"analysis":
"char_filter":
"my_char_filter":
"type": "mapping",
"mappings": [
", => "
]
,
"filter":
"my_synonym_filter":
"type": "synonym",
"expand": true,
"synonyms": [
"lileilei => leileili",
"hanmeimei => meimeihan"
]
,
"analyzer":
"my_analyzer":
"tokenizer": "my_tokenizer",
"char_filter": [
"my_char_filter"
],
"filter": [
"my_synonym_filter"
]
,
"tokenizer":
"my_tokenizer":
"type": "pattern",
"pattern": "\\\\; "
,
"mappings":
"_doc":
"properties":
"text":
"type": "text",
"analyzer": "my_analyzer"
报错详情
"error" :
"root_cause" : [
"type" : "illegal_argument_exception",
"reason" : "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
],
"type" : "illegal_argument_exception",
"reason" : "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
,
"status" : 400
0x02 解决es从6跨越到7,还是有些变化的;在es7中已经在内部取消了_doc这类type;
把上面的语句中删除_doc就行了,改成如下:
PUT my_index
"settings":
"analysis":
"char_filter":
"my_char_filter":
"type": "mapping",
"mappings": [
", => "
]
,
"filter":
"my_synonym_filter":
"type": "synonym",
"expand": true,
"synonyms": [
"lileilei => leileili",
"hanmeimei => meimeihan"
]
,
"analyzer":
"my_analyzer":
"tokenizer": "my_tokenizer",
"char_filter": [
"my_char_filter"
],
"filter": [
"my_synonym_filter"
]
,
"tokenizer":
"my_tokenizer":
"type": "pattern",
"pattern": "\\\\; "
,
"mappings":
"properties":
"text":
"type": "text",
"analyzer": "my_analyzer"
【Elasticsearch7学习笔记之_doc类型被取消】
推荐阅读
- linux 文件压缩与解压缩
- xp为啥不能激活office2010?教你激活office2010的办法
- xp系统无法正常打开怎样办|xp打开失败故障的处理办法
- xp系统电脑运行慢太卡了怎样办|xp系统运行卡顿的处理办法
- xp系统怎样调整分辨率|XP系统如何更改分辨率
- xp系统防火墙设置在啥地方里|xp系统怎样关闭防火墙
- xp系统如何设置开机密码|xp系统电脑怎样改密码
- xp系统无法访问win10系统的共享文件怎样办|设置xp系统与win10局域网共享的办法
- 如何解除xp系统的文件保护|xp系统怎样取消文件保护