Elasticsearch JDBC importer is not working

Hi all,
I was trying to import my data with elasticsearch-jdbc importer from jprante. The execution seems to be successful. But when i look at my index. It's still empty.

This is my execution from the terminal:

echo '{"type":"jdbc","jdbc":{"url":"jdbc:mysql://my_domain.com:3306/my_db","user":"my_user_name","password":"my_password","ignore_null_values":true,"sql":"SELECT * FROM `es_data`","index":"my_index","type":"my_type","elasticsearch":{"cluster":"dev","host":"localhost","port":9200}}}' | java -cp "/opt/elasticsearch-jdbc/lib/*" -Dlog4j.configurationFile=/opt/elasticsearch-jdbc/bin/log4j2.xml org.xbib.tools.Runner org.xbib.tools.JDBCImporter

here in readable way:

echo '{
    "type":"jdbc",
    "jdbc":{
        "url":"jdbc:mysql://my_domain.com:3306/my_db",
        "user":"my_user_name",
        "password":"my_password",
        "ignore_null_values":true,
        "sql":"SELECT * FROM `es_data`",
        "index":"my_index",
        "type":"my_type",
        "elasticsearch":{
            "cluster":"dev",
            "host":"localhost",
            "port":9200
        }
    }
}' | java \
        -cp "/opt/elasticsearch-jdbc/lib/*" \
        -Dlog4j.configurationFile=/opt/elasticsearch-jdbc/bin/log4j2.xml \
        org.xbib.tools.Runner \
        org.xbib.tools.JDBCImporter

Do you have any idea or experience with this plugin? What is wrong with my configuration?

I'm using linux ubuntu and Elasticsearch version is 1.7.1 and latest version of this plugin 1.7.0.1

Thank you in advance for any help
Cheers, Ramy

Now I was able to print out the error message to the console. This is very strange... because I'm executing my PHP code with curl to the same cluster and everything is fine. I'm getting this error only when I start to use the jdbc importer...

here is the error message:

17:00:40.430 [pool-2-thread-1] ERROR importer - error while getting next input: no cluster nodes available, check settings {cluster.name=dev, host.0=localhost, port=9200, sniff=false, autodiscover=false, name=importer, client.transport.ignore_cluster_name=false, client.transport.ping_timeout=5s, client.transport.nodes_sampler_interval=5s}
...

Well I've found the solution for my problem. There were two troubles

  1. Elasticsearch version: I was using version 1.7.1 and the JDBC Importer with version 1.7.0.1 is only supporting Elasticsearch version 1.7.0
  2. Port number: I was using the port number 9200 for my curl calls and importer call. Now I'm using port 9200 for my curl calls and 9300 for the importer call

cheers, Ramy

Hi @remram

How can the JDBC importer work on Windows ? If you have any idea, please share .
Thank you .

Please start your own thread. Your question is also very generic. The more details you can provide, the better answer you generally get.

Okay ! sure will start a thread. Thanks

does elasticsearch-jdbc 2.3.4 support es 511? i'm not sure

No, Please take a look at the table for compatiblity
Compatiblity matrix

JDBC importer for 5.1.1 is still ongoing work.

1 Like