1

Today I have started working on Elastic Search, in my last project I have done the searching in Solr, and I was importing data from mysql and that was pretty simple.

Now I have to do same work in Elastic search, and successfully done the setup I have started working as per "https://github.com/jprante/elasticsearch-jdbc#quick-links" but getting error.

java.lang.IllegalStateException: Received message from unsupported version: [2.0.0] minimal compatible version is: [5.0.0]

I am using Elastic Search version 5.0.0 and using the "wget http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.3.4.0/elasticsearch-jdbc-2.3.4.0-dist.zip" which is maximum available version.

Please suggest on this.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Deepesh Uniyal
  • 923
  • 3
  • 20
  • 44

1 Answers1

2

You can use the jdbc plugin in your logstash config in order to upload data to your index and then make sure you could keep updating it by adding a scheduler according to your need.

Your logstash config could look like this:

input {
  jdbc {
    jdbc_driver_library => "/mysql-connector-java-5.1.39-bin.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://localhost:3306/database_name"
    jdbc_user => "root"
    jdbc_password => "password"
    schedule => "* * * * *"
    statement => "select * from table1"
    type => "table1"
  }
}
output {
    elasticsearch {
        index => "testdb"
        document_type => "%{type}"   # <- use the type from each input
        hosts => "localhost:9200"
    }
}
Kulasangar
  • 9,046
  • 5
  • 51
  • 82