为什么从sqlserver中删除记录时Elasticsearch不更新

时间:2018-11-01 12:17:35

标签: sql-server elasticsearch elastic-stack

当我在Sqlserver中更新或插入记录时,我已使用Logstash配置文件将ElasticSearch连接到SqlServer,“ ElasticSearch”索引已使用新的/更改的记录进行更新,但是问题是当我从sqlserver删除记录时,” ElasticSearch“索引未使用已删除的记录进行更新。.它仍在索引中显示已删除的记录。在logstash文件中是否有用于已删除记录的任何配置或设置?

Here is my logstash file   

input {  

    jdbc {  

        jdbc_driver_library => "C:\Program Files\Microsoft JDBC Driver 6.4 for SQL Server\sqljdbc_6.4\enu\mssql-jdbc-6.4.0.jre8.jar"  
        jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
        jdbc_connection_string => "jdbc:sqlserver://XXXXXXXX;User Id=XXXXXXX;password=XXXXX;databaseName=XXX;"    
        jdbc_user => "XXXXXX"   
        jdbc_password => "XXXXXXXX"     
        statement => "select employeeId,empname,salary,DOB,lastmodifiedDate from                employee where LastModifiedDate>:sql_last_value"     
        use_column_value => true               
        tracking_column => lastmodifieddate     
        tracking_column_type => "timestamp"    
        jdbc_paging_enabled => "true"   
        schedule => "* * * * * *"   
        clean_run => false  }  }      
filter {
}       
output {    
    stdout {  
        codec => rubydebug
    }  
    elasticsearch {  
        hosts => "http://localhost:9200/"  
        index => "emp_index" 
        document_id => "%{employeeId}"     
        document_type => "emp_type"     

    }  
}



  Regards,  
  raj.

1 个答案:

答案 0 :(得分:0)

logstash中没有可用的即开即用选项来实现您想要的。请参阅Delete old documents from Elastic Search using logstash