首页 > 解决方案 > 使用 Postman 创建 ElasticSearch 索引时出错

问题描述

我正在尝试使用官方 javascript 客户端创建一个带有映射的弹性搜索索引。当我尝试在没有索引的情况下创建时,一切顺利,但在创建索引时出现错误。

这是我的架构:

    {
    "mappings":{
        "post":{
            "properties":{
                "city":{
                    "type": "text"
                },
                "contact_email":{
                    "type": "text"
                },
                "country":{
                    "type": "text"
                },
                "description":{
                    "type": "text"
                },
                "image":{
                    "type": "text"
                },
                "post_id":{
                    "type": "text"
                },
                "state_province":{
                    "type": "text"
                },
                "title":{
                    "type": "text"
                },
                "user_id":{
                    "type": "text"
                }
            }
        }
    }
}

当我执行上面的命令时,我得到这个错误:

{
    "error": {
        "root_cause": [
            {
                "type": "mapper_parsing_exception",
                "reason": "Root mapping definition has unsupported parameters:  [post : {properties={country={type=text}, image={type=text}, post_id={type=text}, city={type=text}, user_id={type=text}, description={type=text}, state_province={type=text}, title={type=text}, contact_email={type=text}}}]"
            }
        ],
        "type": "mapper_parsing_exception",
        "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [post : {properties={country={type=text}, image={type=text}, post_id={type=text}, city={type=text}, user_id={type=text}, description={type=text}, state_province={type=text}, title={type=text}, contact_email={type=text}}}]",
        "caused_by": {
            "type": "mapper_parsing_exception",
            "reason": "Root mapping definition has unsupported parameters:  [post : {properties={country={type=text}, image={type=text}, post_id={type=text}, city={type=text}, user_id={type=text}, description={type=text}, state_province={type=text}, title={type=text}, contact_email={type=text}}}]"
        }
    },
    "status": 400
}

标签: elasticsearchpostmanelasticsearch-6

解决方案


推荐阅读