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

  • 相关阅读:
    类的组合
    类的继承和派生
    面向对象编程
    正则表达式
    sys模块 logging模块 序列化模块
    time 模块,random模块,os模块
    递归函数
    interface有没有继承Object
    UTF-8和GBK的区别
    九皇后
  • 原文地址:https://www.cnblogs.com/HByang/p/13955975.html
Copyright © 2011-2022 走看看