Logstash错误:拒绝将映射更新更新为[db],因为最终映射将具有1种以上的类型:[meeting_invities,会议室“}}}}

时间:2019-11-21 09:54:32

标签: elasticsearch logstash

Rejecting mapping update to [db] as the final mapping would have more than 1 type: [meeting_invities, meetingroom
"}}}}

下面是我的logstatsh-mysql.conf,我必须在jdbc输入中使用多个表。请指教

input {
    jdbc {
        jdbc_connection_string => "jdbc:mysql://localhost:3306/db"
        jdbc_user => "root"
        jdbc_password => "pwd"

        jdbc_driver_class => "com.mysql.jdbc.Driver"
        statement => "SELECT * FROM meeting"
        tags => "dat_meeting"
    }
    jdbc {
        jdbc_connection_string => "jdbc:mysql://localhost:3306/db"
        jdbc_user => "root"
        jdbc_password => "pwd"

        jdbc_driver_class => "com.mysql.jdbc.Driver"
        statement => "SELECT * FROM meeting_invities;"
        tags => "dat_meeting_invities"


    }
}
output {
    stdout { codec => json_lines }
    if "dat_meeting" in [tags]{elasticsearch {
        hosts => "localhost:9200"
        index => "meetingroomdb"

         document_type => "meeting"   
    }
    }

    if "dat_meeting_invities" in [tags]{elasticsearch {
        hosts => "localhost:9200"
        index => "meetingroomdb"

         document_type => "meeting_invities"   
    }
    }
}

1 个答案:

答案 0 :(得分:0)

您的elasticsearch输出使用具有两个不同值的选项_type,此选项设置索引的document_type字段,因为版本6.X只能在索引中使用一种类型。

此选项在7.X版本中已弃用,由于elasticsearch即将typeless使用,因此在以后的版本中将不再使用。

由于elasticsearch不允许您索引多个索引类型,因此您需要查看索引的第一个文档的类型是什么,这是elasticsearch将用于以后的任何文档的类型,请在两者中都使用$data = [ 1 => [ "title" => "TITLE ONE", "groups" => [[ "Some question?" => $submission->answerOne ? "Yes": "No", "Some question?" => $submission->answerTwo ? "Yes": "No", "Some question?" => $submission->answerThree, "Some question?" => $submission->answerFour ? "Yes": "No", "Some question?" => $submission->answerFive ? "Yes": "No", ]] ], "title" => "TITLE TWO", "groups" => [[ "Title" => $submission->title, ]] ] ]; 选项。