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

版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。

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

在elasticsearch7.x上执行:


  1. put es_test
  2. {
  3. "settings":{
  4. "number_of_shards" : 3,
  5. "number_of_replicas" : 0
  6. },
  7. "mappings":{
  8. "books":{
  9. "properties":{
  10. "title":{"type":"text"},
  11. "name":{"type":"text","index":false},
  12. "publish_date":{"type":"date","index":false},
  13. "price":{"type":"double"},
  14. "number":{
  15. "type":"object",
  16. "dynamic":true
  17. }
  18. }
  19. }
  20. }
  21. }

执行结果则会出错:Root mapping definition has unsupported parameters


  1. {
  2. "error": {
  3. "root_cause": [
  4. {
  5. "type": "mapper_parsing_exception",
  6. "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}}}]"
  7. }
  8. ],
  9. "type": "mapper_parsing_exception",
  10. "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}}}]",
  11. "caused_by": {
  12. "type": "mapper_parsing_exception",
  13. "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}}}]"
  14. }
  15. },
  16. "status": 400
  17. }

如果在6.x上执行,则会正常执行


  1. {
  2. "acknowledged" : true
  3. }

出现这个的原因是,elasticsearch7默认不在支持指定索引类型,默认索引类型是_doc,如果想改变,则配置include_type_name: true 即可(这个没有测试,官方文档说的,无论是否可行,建议不要这么做,因为elasticsearch8后就不在提供该字段)。官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html

所以在Elasticsearch7中应该这么创建索引


  1. put /test
  2. {
  3. "settings":{
  4. "number_of_shards":3,
  5. "number_of_replicas":2
  6. },
  7. "mappings":{
  8. "properties":{
  9. "id":{"type":"long"},
  10. "name":{"type":"text","analyzer":"ik_smart"},
  11. "text":{"type":"text","analyzer":"ik_max_word"}
  12. }
  13. }
  14. }
  15. put /test1
  16. {
  17. "settings":{
  18. "number_of_shards":3,
  19. "number_of_replicas":2
  20. },
  21. "mappings":{
  22. "properties":{
  23. "id":{"type":"long"},
  24. "name":{"type":"text"},
  25. "text":{"type":"text"}
  26. }
  27. }
  28. }

对人工智能感兴趣的同学,可以点击以下链接:

现在人工智能非常火爆,很多朋友都想学,但是一般的教程都是为博硕生准备的,太难看懂了。最近发现了一个非常适合小白入门的教程,不仅通俗易懂而且还很风趣幽默。所以忍不住分享一下给大家。点这里可以跳转到教程。

https://www.cbedai.net/u014646662

ElasticSearch 7.x 默认不在支持指定索引类型的更多相关文章

  1. MyISAM、InnoDB、Memory这3个常用引擎支持的索引类型

    表格对比了MyISAM.InnoDB.Memory这3个常用引擎支持的索引类型: 索引 MyISAM引擎 InnoDB引擎 Memory引擎 B-Tree索引 支持 支持 支持 HASH索引 不支持 ...

  2. IIS在默认情况并不支持对PUT和DELETE请求的支持

    IIS在默认情况并不支持对PUT和DELETE请求的支持: IIS拒绝PUT和DELETE请求是由默认注册的一个名为:“WebDAVModule”的自定义HttpModule导致的.WebDAV的全称 ...

  3. 解决iOS中tabBarItem图片默认颜色的问题(指定代码渲染模式为以原样模式的方式显示出来)

    解决iOS中tabBarItem图片默认颜色的问题(指定代码渲染模式为以原样模式的方式显示出来) 解决办法:指定图片的渲染模式(imageWithRenderingMode为:UIImageRende ...

  4. Android spinner默认样式不支持换行和修改字体样式的解决方法

    在spinner中显示的数据过多,需要换行,而Android自身提供的android.R.layout.simple_spinner_dropdown_item样式不支持换行,因此参考android提 ...

  5. ElasticSearch 5学习(9)——映射和分析(string类型废弃)

    在ElasticSearch中,存入文档的内容类似于传统数据每个字段一样,都会有一个指定的属性,为了能够把日期字段处理成日期,把数字字段处理成数字,把字符串字段处理成字符串值,Elasticsearc ...

  6. ElasticSearch(五):Mapping和常见字段类型

    ElasticSearch(五):Mapping和常见字段类型 学习课程链接<Elasticsearch核心技术与实战> 什么是Mapping Mapping类似数据库中的schema的定 ...

  7. jquery ajax中支持哪些返回类型以及js中判断一个类型常用的方法?

    1 jquery ajax中支持哪些返回类型在JQuery中,AJAX有三种实现方式:$.ajax() , $.post , $.get(). 预期服务器返回的数据类型.如果不指定,jQuery 将自 ...

  8. Elasticsearch(5)--- 基本命令(集群相关命令、索引CRUD命令、文档CRUD命令)

    Elasticsearch(5)--- 基本命令 这篇博客的命令分为ES集群相关命令,索引CRUD命令,文档CRUD命令.这里不包括Query查询命令,它单独写一篇博客. 一.ES集群相关命令 ES集 ...

  9. Java语言支持的变量类型有哪几种

    Java语言支持的变量类型有: 类变量:独立于方法之外的变量,用 static 修饰. 实例变量:独立于方法之外的变量,不过没有 static 修饰. 局部变量:类的方法中的变量. 实例: publi ...

随机推荐

  1. spring中试用junit4测试

    一:加入jar包 <!-- 单元测试 --> <dependency> <groupId>junit</groupId> <artifactId& ...

  2. Comet OJ - Contest #7 D 机器学习题 斜率优化 + 未调完

    Code: #include <cstdio> #include <algorithm> #include <cstring> #define setIO(s) f ...

  3. Java——package与import

    [package]   <1>为了解决类的命名冲突问题,Java引入包(package)机制,提供类的多重类命名空间. <2>package作为源文件的第一条语句(缺省时指定为 ...

  4. Go简易分布式对象存储 合并文件的所有分块为一个文件

    项目 项目地址: https://github.com/Draymonders/cloud 欢迎大家Watch or Star 缘由 由于项目中对大文件进行5MB为一个分块上传(多线程,提升上传效率) ...

  5. [洛谷P5106]dkw的lcm:欧拉函数+容斥原理+扩展欧拉定理

    分析 考虑使用欧拉函数的计算公式化简原式,因为有: \[lcm(i_1,i_2,...,i_k)=p_1^{q_{1\ max}} \times p_2^{q_{2\ max}} \times ... ...

  6. [BZOJ3262]:陌上花开(CDQ分治)

    题目传送门 题目描述 有$n$朵花,每朵花有三个属性:花形$(s)$.颜色$(c)$.气味$(m)$,用三个整数表示.现在要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量.定义一朵花$A$比 ...

  7. 用Python给头像加上圣诞帽或圣诞老人小图标

    随着圣诞的到来,想给给自己的头像加上一顶圣诞帽.如果不是头像,就加一个圣诞老人陪伴.   用Python给头像加上圣诞帽,看了下大概也都是来自2017年大神的文章:https://zhuanlan.z ...

  8. ERROR 1366 (HY000): Incorrect string value:MySQL数据库、表的字符集为GBK

    mysql> update userinfo set MEDIASOURCE = 'CS02-北京' where IMPORTNO = 'IMP201640613101206';ERROR 13 ...

  9. 内存地址 Memory Management

    Memory Management https://docs.python.org/2/c-api/memory.html Memory management in Python involves a ...

  10. elasticsearch 7.2 集群节点配置

    conf/elasticsearch.yml对其修改,在下面添加修改: 主节点的配置 http.cors.enabled: true http.cors.allow-origin: "*&q ...