Update Mechanisam for Jdbc plugin and elasticsearch


(sowmyak) #1

Hi,

I have a problem using JDBC plugin with elasticsearch and mysql.
I am able to poll and retrieve the values using Polling.

But, When I am using the method of Updating Mechanisms, I am not able to index the values into ElasticSearch.

when I am using -XGET to retrieve the indexes, it is giving me 0 hits.

This is the procedure that I have followed for getting my updates on mysql table reflected on elasticsearch index.

Step 1: create table class_info(rno int, name varchar(100)); //Create a table in mysql database
Step 2 : create table my_jdbc_river(_index varchar(64), _type varchar(64), _id varchar(64), source_timestamp timestamp not null default current_timestamp, source_operation varchar(8), source_sql varchar(255), target_timestamp timestamp, target_operation varchar(8) default 'n/a', target_failed boolean, target_message varchar(255), primary key(_index, _type, _id, source_timestamp, source_operation));
//create a river table in mysql database

Step 3: Create a trigger on class_info table to insert the rows into my_jdbc_river on insert operation
delimiter $$

create trigger check_root after insert on class_info for each row begin insert into my_jdbc_river values("index", "type", "id", null, 'create', 'select * from check_es', null, null, true, null); end$$

delimiter ;

I am not sure whether the parameters to insert statement are correct or not.

Step 4: Create a river on ElasticSearch
curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{ "type" : "jdbc", "jdbc" : { "driver" : "com.mysql.jdbc.Driver", "url" : "jdbc:mysql://localhost:3306/testes", "user" : "root", "password" : "p00ph34d", "poll" : "300s","rivertable" : true, "interval" : "305s" }, "index" : { "index" : "jdbc","type" : "jdbc", "bulk_size" : 100,"max_bulk_requests" : 30, "bulk_timeout" : "60s"} }'

And, when i am inserting the values into class_info they are not being indexed in elasticsearch.

Please let me know the correct procedure I am missing anything or misunderstood the concept.

Thanks!


(sowmyak) #2

Hi,

Please let me know if you have any questions regarding my doubt.

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Update-Mechanisam-for-Jdbc-plugin-and-elasticsearch-tp4021313p4021318.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #3