我使用JDBC输入插件创建了logstash配置文件,以便将Oracle数据库表引入elasticsearch,并且每五分钟就按计划进行一次。
它按预期工作但问题是,它在第二次,第三次运行时插入重复记录。我们如何避免将重复记录插入到elasticsearch中。?
请使用JDBC输入插件找到我的logstash配置文件
function printall() {
printstring("A")
.then(function() { printstring("C"); })
}
请找到我的文档表架构
input {
jdbc {
jdbc_driver_library => "D:\1SearchEngine\data\ojdbc8.jar"
jdbc_driver_class => "Java::oracle.jdbc.OracleDriver"
jdbc_connection_string => "jdbc:oracle:thin:@localhost:1521:XE"
jdbc_user => "demo"
jdbc_password => "1234567"
schedule => "*/5 * * * *"
statement => "select * from documents"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "schedule1_documents"
}
}
答案 0 :(得分:1)
您需要使用<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/add_class_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_add_white_24dp"
app:useCompatPadding="true" />
<ListView
android:id="@+id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"></ListView>
</android.support.design.widget.CoordinatorLayout>
表中的id字段。否则,ES将自己创建一个id。
所以你的输出应该是这样的:
documents