使用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 jail 折腾记(一)

    创建jail目录 mkdir -p /usr/jail/ 放入基本系统 方案一 make buildworld #编译基本系统 make installworld DESTDIR=/usr/jail/ ...

  2. C# 基础 - 日志捕获一使用 StreamWriter

    public static class LogHelper { private static readonly string _baseDir = AppDomain.CurrentDomain.Ba ...

  3. vue 折线柱状图

    需求:折线柱状图实现,显示不同提示,颜色,标记等等. 图例: 实现: <template> <div class="transaction-barline"> ...

  4. java知识汇总

    文章目录 Java基础知识 基本类型 类别及其对应包装类 1. byte---Byte 2. char---Character 3. short---Short 4. int---Integer 5. ...

  5. Go语言学习笔记——在本地建立一个官网查看

    命令行内运行 godoc -http=:8080 运行完成后打开浏览器输入网址:http://localhost:8080能看到一个和官网一模一样的网站,然后查看帮助文档

  6. Python中异步协程的使用方法介绍

    1. 前言 在执行一些 IO 密集型任务的时候,程序常常会因为等待 IO 而阻塞.比如在网络爬虫中,如果我们使用 requests 库来进行请求的话,如果网站响应速度过慢,程序一直在等待网站响应,最后 ...

  7. 教你如何用Python模拟http请求(GET,POST)

    模拟http请求有什么用呢? 我们现在使用的所有需要使用网络的:软件 应用 app 网站里面的绝大部分功能都是通过http协议来工作的 什么是http协议? http协议,超文本传输协议(HTTP,H ...

  8. XML数据持久化学习笔记

    一.XML基础语法 1.XML结构:XML是一种树结构的文本 2.XML注释:格式:<!--在其中书写注释-->,在注释中可以单行注释也可以多行注释 3.固定内容:<?xml ver ...

  9. 全网最详细的Linux命令系列-cat命令

    cat命令的用途是连接文件或标准输入并打印.这个命令常用来显示文件内容,或者将几个文件连接起来显示,或者从标准输入读取内容并显示,它常与重定向符号配合使用. 命令格式: cat [选项] [文件].. ...

  10. E. 【例题5】平铺方案

    E . [ 例 题 5 ] 平 铺 方 案 E. [例题5]平铺方案 E.[例题5]平铺方案 解析 由于最近赶进度,解析写的就很简略 通过推算得出递推式 a [ i ] = a [ i − 1 ] + ...