illegal_argument_exception

来源:4-1 索引创建

慕用8226845

2018-11-14 18:42

{
    "settings":{
        "number_of_shards":3,
        "number_of_replicas":1
    },
    "mappings":{
        "man":{
            "properties":{
                "name":{
                    "type":"text"
                },
                "country":{
                    "type":"keyword"
                },
                "age":{
                    "type":"integer"
                },
                "date":{
                    "type":"date",
                    "format":"yyyy-MM-dd HH-mm-ss||yyyy-MM-dd"
                }
                
            }
        },
        "woman":{
            
        }
    }
}



返回结果

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Rejecting mapping update to [people] as the final mapping would have more than 1 type: [woman, man]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "Rejecting mapping update to [people] as the final mapping would have more than 1 type: [woman, man]"
    },
    "status": 400
}

写回答 关注

2回答

  • 残阳星陨
    2019-06-10 17:16:41
    • Indices created in 6.x only allow a single-type per index. Any name can be used for the type, but there can be only one.


  • 慕用8226845
    2018-11-14 18:45:12

    错误翻译拒绝将映射更新发送给[people],因为最终映射将不止一种类型:[女性,男性]

    去掉woman 这个类型

    {
        "acknowledged": true,
        "shards_acknowledged": true,
        "index": "people"
    }

ElasticSearch入门

ElasticSearch轻松入门,Spring Boot集成ES

67752 学习 · 308 问题

查看课程