码迷,mamicode.com
首页 > 其他好文 > 详细

ElasticSearch 7.x 指定索引类型出现下面错误

时间:2020-11-16 13:50:38      阅读:8      评论:0      收藏:0      [点我收藏+]

标签:mapping   arch   fail   stat   tps   use   shard   number   guid   

 执行代码

# 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

ElasticSearch 7.x 指定索引类型出现下面错误

标签:mapping   arch   fail   stat   tps   use   shard   number   guid   

原文地址:https://www.cnblogs.com/HByang/p/13955975.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!