ElasticSearch 导入索引时报错 Rejecting mapping update to [xxx] as the final mapping would have more than 1 type: [xxx, xxx]

08-06 19:02 116 0

尝试在一个 ElasticSearch 的 index 中导入多个 type 时报错,报错信息如下:

[responseCode] => 400
    [responseHeaders] => Array
        (
            [content-type] => application/json; charset=UTF-8
            [content-length] => 355
        )

    [responseBody] => Array
        (
            [error] => Array
                (
                    [root_cause] => Array
                        (
                            [0] => Array
                                (
                                    [type] => illegal_argument_exception
                                    [reason] => Rejecting mapping update to [shiqidu] as the final mapping would have more than 1 type: [discussion, article]
                                )

                        )

                    [type] => illegal_argument_exception
                    [reason] => Rejecting mapping update to [shiqidu] as the final mapping would have more than 1 type: [discussion, article]
                )

            [status] => 400
        )

原因:6.0的版本不允许一个 index 下面有多个 type,并且官方说是在接下来的7.0版本中会删掉 type ,官方说明 ,搞得有点迷,看一些文章说 ElasticSearch 的 index 相当于 数据库type 相当于 数据表,但是现在看来,如果要储存多个表的数据,还是得建立多个 index 索引。

做自己喜欢做的事。
Up骚年
Up骚年 站长 @ 十七度 创建者 声望
all or nothing, now or never.
0 人点赞
0 条评论
排序方式 时间 投票
快来抢占一楼吧
请登录后发表评论