使用ElasticSearch创建映射报错

Root mapping definition has unsupported parameters

原因

使用的ES版本为7.2.0,不再支持创建指定类型,索引的默认类型为_doc.

官网图片

解决办法

创建索引的映射时,不需要指定类型即可

错误再现

错误的创建索引语句

PUT /dangdang1
{
"mappings": {
"book":{ # 这里指定了类型type
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "keyword"
},
"price": {
"type": "double"
},
"detail": {
"type": "text"
}
}
}
}
}

报错信息

{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [book : {properties={price={type=double}, name={type=keyword}, id={type=integer}, detail={type=text}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [book : {properties={price={type=double}, name={type=keyword}, id={type=integer}, detail={type=text}}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [book : {properties={price={type=double}, name={type=keyword}, id={type=integer}, detail={type=text}}}]"
}
},
"status": 400
}

正确的创建索引映射的语句

PUT /dangdang
{
"mappings": {
# 这里不再写类型
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "keyword"
},
"price": {
"type": "double"
},
"detail": {
"type": "text"
}
}
}
}

Root mapping definition has unsupported parameters的更多相关文章

  1. ElasticSearch 7.4.2 Root mapping definition has unsupported parameters

    新建索引 PUT people { "settings":{ "number_of_shards":3, "number_of_replicas&qu ...

  2. Pycharm,出现Invalid VCS root mapping The directory 解决方法

    Pycharm File 中setting-------version control  中VCS选择none  后选择ok 执行完以上的步骤,还错误就会消失.

  3. ElasticSearch基础知识讲解

    第一节 ElasticSearch概述 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTfull web接口.ElasticSea ...

  4. ElasticSearch 7.x 默认不在支持指定索引类型

    原文:ElasticSearch 7.x 默认不在支持指定索引类型 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://bl ...

  5. ElasticSearch 基本概念 and 索引操作 and 文档操作 and 批量操作 and 结构化查询 and 过滤查询

    基本概念 索引: 类似于MySQL的表.索引的结构为全文搜索作准备,不存储原始的数据. 索引可以做分布式.每一个索引有一个或者多个分片 shard.每一个分片可以有多个副本 replica. 文档: ...

  6. ElasticSearch添加索引

    1. 编写索引内容 节点解释: settings:配置信息 "number_of_replicas": 0  不需要备份(单节点的ElasticSearch使用) "ma ...

  7. SpringBoot进阶教程(七十三)整合elasticsearch

    Elasticsearch 是一个分布式.高扩展.高实时的搜索与数据分析引擎.它能很方便的使大量数据具有搜索.分析和探索的能力.充分利用Elasticsearch的水平伸缩性,能使数据在生产环境变得更 ...

  8. elasticsearch 口水篇(6) Mapping 定义索引

    前面我们感觉ES就想是一个nosql数据库,支持Free Schema. 接触过Lucene.solr的同学这时可能会思考一个问题——怎么定义document中的field?store.index.a ...

  9. elasticsearch Mapping 定义索引

    Mapping is the process of defining how a document should be mapped to the Search Engine, including i ...

随机推荐

  1. 我与FreeBSD的故事之三

    联想G400 是我在国美电器线下买的笔记本.我什么也不懂,就随便买了,不随便也不行,谁都知道只要不是那种特别的奸商,基本上货物都是符合价值决定价格这个基本的经济学规律的.所以没钱就失去了选择的自由.到 ...

  2. 前端学习 node 快速入门 系列 —— 简易版 Apache

    其他章节请看: 前端学习 node 快速入门 系列 简易版 Apache 我们用 node 来实现一个简易版的 Apache:提供静态资源访问的能力. 实现 直接上代码. - demo - stati ...

  3. imagemagick 之 Fred's ImageMagick Scripts 在Ubuntu 下的实践

    Fred's ImageMagick Scripts 官网:http://www.fmwconcepts.com/imagemagick/index.php Windows 10 (64-bit) u ...

  4. Prometheus时序数据库-数据的查询

    Prometheus时序数据库-数据的查询 前言 在之前的博客里,笔者详细阐述了Prometheus数据的插入过程.但我们最常见的打交道的是数据的查询.Prometheus提供了强大的Promql来满 ...

  5. (五)SpringBoot启动过程的分析-刷新ApplicationContext

    -- 以下内容均基于2.1.8.RELEASE版本 紧接着上一篇[(四)SpringBoot启动过程的分析-预处理ApplicationContext] (https://www.cnblogs.co ...

  6. Android Studio 分类整理 res/layout 中的布局文件

    •准备工作 新建一个名为 TestLayouts 的项目: 进入 Project 模式: 来到 TestLayouts/app/src/main/res/layout 文件夹下: •分类整理 layo ...

  7. Python基础之:Python中的类

    目录 简介 作用域和命名空间 class 类对象 类的实例 实例对象的属性 方法对象 类变量和实例变量 继承 私有变量 迭代器 生成器 简介 class是面向对象编程的一个非常重要的概念,python ...

  8. C/C++ 中的算术及其陷阱

    目录 概述 C/C++ 整数的阴暗角落 整型字面量 整型提升与寻常算术转换 算术溢出检测 位运算技巧 总结 参考 概述 无符号数和有符号数是通用的计算机概念,具体到编程语言上则各有各的不同,程序员是解 ...

  9. TypeError: myMethod() takes no arguments (1 given) Python常见错误

      忘记为方法的第一个参数添加self参数 ---------------------------------------------------------------

  10. 第一个真正的 GUI 程序——Tkinter教程系列02

    第一个真正的 GUI 程序--Tkinter教程系列02 前言 欢迎光临我的个人博客 chens.life Tk 系列教程: Tkinter教程系列01--引言和安装Tk 我们将编写一个英尺和米的转换 ...