Logstash迁移ES5.6.1一个索引多type类型迁移到ES7.6.2无type类型

input {
    stdin{
    }
    elasticsearch {
        hosts => ["http://127.0.0.1:9200"]
        user => "admin"
        index => "user_info"
        password => "admin"
        docinfo => true
    }
    
}

filter{
     mutate {
        remove_field => ["@version"] #去除版本号
     }
     mutate{
        add_field => ["typeCode","%{[@metadata][_type]}"] #type替换成typeCode
     } 
}

output {
    
    elasticsearch {
        hosts => ["http://127.0.0.2:9200"]
        user => elastic
        password => elastic
        index => "user_info"
        #document_type => "%{[@metadata][_type]}"
        #document_id => "%{[@metadata][_id]}"
    }
    stdout {
        codec => json_lines
    }
    
}

 

posted @ 2020-09-11 11:33  表演给自己看的认真  阅读(611)  评论(0编辑  收藏  举报