zoukankan      html  css  js  c++  java
  • ElasticSearch 7.x 指定索引类型出现下面错误

     执行代码

    # PUT请求: http://IP地址:端口/t1
    
    {
        "settings": {
            "index": {
                "number_of_shards": "2",
                "number_of_replicas": "0"
            }
        },
        "mappings": {
            "person": {
                "properties": {
                    "name": {
                        "type": "text"
                    },
                    "age": {
                        "type": "integer"
                    },
                    "mail": {
                        "type": "keyword"
                    },
                    "hobby": {
                        "type": "text"
                    }
                }
            }
        }
    }

     错误:

    {
        "error": {
            "root_cause": [
                {
                    "type": "mapper_parsing_exception",
                    "reason": "Root mapping definition has unsupported parameters:  [person : {properties={mail={type=keyword}, name={type=text}, age={type=integer}, hobby={type=text}}}]"
                }
            ],
            "type": "mapper_parsing_exception",
            "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [person : {properties={mail={type=keyword}, name={type=text}, age={type=integer}, hobby={type=text}}}]",
            "caused_by": {
                "type": "mapper_parsing_exception",
                "reason": "Root mapping definition has unsupported parameters:  [person : {properties={mail={type=keyword}, name={type=text}, age={type=integer}, hobby={type=text}}}]"
            }
        },
        "status": 400
    }

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

    出现这个的原因是,elasticsearch7默认不在支持指定索引类型,默认索引类型是_doc,如果想改变,则配置include_type_name: true 即可。官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html

  • 相关阅读:
    外观模式
    享元模式
    c#中的抽象类和接口
    装饰者模式
    组合模式
    适配器模式
    springboot 源码篇002## web层自动装配部分源码
    springboot 源码篇002## 自动装配原理
    springboot 源码篇 01
    shell 脚本基础 第二篇
  • 原文地址:https://www.cnblogs.com/HByang/p/13955975.html
Copyright © 2011-2022 走看看