elasticsearch,Mysql,elasticsearch" /> elasticsearch,Mysql,elasticsearch" />

使用JDBC驱动程序从ElasticSearch中的MySQL表加载动态数据

使用JDBC驱动程序从ElasticSearch中的MySQL表加载动态数据,mysql,elasticsearch,Mysql,elasticsearch,我已经从elasticSearch索引中的MySQL表中获得动态数据。为此,我使用了以下链接,但未获得支持结果: 我使用了以下代码: echo '{ "type":"jdbc", "jdbc":{ "url":"jdbc:mysql://localhost:3306/CDFL", "user":"root", "password":"root", "useSSL":"false", "sql":"SELECT * FROM event",

我已经从elasticSearch索引中的MySQL表中获得动态数据。为此,我使用了以下链接,但未获得支持结果:

我使用了以下代码:

echo '{
    "type":"jdbc",
    "jdbc":{

    "url":"jdbc:mysql://localhost:3306/CDFL",
    "user":"root",
    "password":"root",
    "useSSL":"false",
    "sql":"SELECT * FROM event",
    "index":"event",
    "type":"event",
    "autocommit":"true",
    "metrics": {
                "enabled" : true
            },
            "elasticsearch" : {
                 "cluster" : "servercluster",
                 "host" : "localhost",
                 "port" : 9300 
            } 
    }
    }' | java -cp "/etc/elasticsearch/elasticsearch-jdbc-2.3.4.0/lib/*" -"Dlog4j.configurationFile=file:////etc/elasticsearch/elasticsearch-jdbc-2.3.4.0/bin/log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"
对于get解决方案,我使用了以下链接:


我已经得到了这个问题的答案: 在根目录中创建一个名为event.sh的文件,并在该文件中创建以下代码

event.sh

curl -XDELETE 'localhost:9200/event'
bin=/etc/elasticsearch/elasticsearch-jdbc-2.3.4.0/bin
lib=/etc/elasticsearch/elasticsearch-jdbc-2.3.4.0/lib
echo '{
"type":"jdbc",
"jdbc":{

"url":"jdbc:mysql://localhost:3306/CDFL",
"user":"root",
"password":"root",
"useSSL":"false",
"sql":"SELECT * FROM event",
"index":"event",
"type":"event",
"poll" : "6s",
"autocommit":"true",
"metrics": {
            "enabled" : true
        },
        "elasticsearch" : {
             "cluster" : "servercluster",
             "host" : "localhost",
             "port" : 9300 
        } 
}
}' | java -cp "/etc/elasticsearch/elasticsearch-jdbc-2.3.4.0/lib/*" -"Dlog4j.configurationFile=file:////etc/elasticsearch/elasticsearch-jdbc-2.3.4.0/bin/log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"
echo "sleeping while importer should run..."
sleep 10
curl -XGET 'localhost:9200/event/_refresh'
并在cmd中运行该文件,键入以下命令:

sh elasticSearch/event.sh
那很好