作者:陈醉在线wx | 来源:互联网 | 2023-01-17 09:33
我想将tom_test2 postgresql表导出到弹性搜索.该表有176805行:
=> select count(*) from tom_test2;
count
--------
176805
(1 row)
以下logstach conf文件将我的数据正确导入弹性搜索:
input {
jdbc {
# Postgres jdbc connection string to our database, mydb
jdbc_connection_string => "xxx"
# The user we wish to execute our statement as
jdbc_user => "xxx"
jdbc_password => "xxx"
# The path to our downloaded jdbc driver
jdbc_driver_library => "xxx"
# The name of the driver class for Postgresql
jdbc_driver_class => "org.postgresql.Driver"
# our query
statement => "select * from tom_test2"
}
}
output {
elasticsearch {
hosts => ["xxx"]
index => "tom"
document_type => "tom_test"
}
}
在弹性搜索中:
GET tom/tom_test/_search
"hits": {
"total": 176805,
"max_score": 1,
}
我在弹性搜索中删除我的索引:
delete tom
我现在想使用jdbc_page_size进行相同的操作,以防我的数据变大,我的logstach conf文件现在是:
input {
jdbc {
# Postgres jdbc connection string to our database, mydb
jdbc_connection_string => "xxx"
# The user we wish to execute our statement as
jdbc_user => "xxx"
jdbc_password => "xxx"
# The path to our downloaded jdbc driver
jdbc_driver_library => "xxx"
# The name of the driver class for Postgresql
jdbc_driver_class => "org.postgresql.Driver"
# our query
statement => "select * from tom_test2"
jdbc_page_size => 1000
jdbc_paging_enabled => true
}
}
output {
elasticsearch {
hosts => ["xxx"]
index => "tom"
document_type => "tom_test"
}
}
我的计数现在错了:
GET tom/tom_test/_search
"hits": {
"total": 106174,
"max_score": 1,
}
如176805-106174 = 70631行丢失