# How to detect changes in database and automatically adding new row to elasticsearch index

**URL:** <https://discuss.elastic.co/t/how-to-detect-changes-in-database-and-automatically-adding-new-row-to-elasticsearch-index/23328>\
**Category:** Elasticsearch\
**Created:** [April 20, 2015, 4:43pm UTC](https://discuss.elastic.co/t/how-to-detect-changes-in-database-and-automatically-adding-new-row-to-elasticsearch-index/23328 "2015-04-20T16:43:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snosek](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@snosek](https://discuss.elastic.co/u/snosek)\
**Post date:** [April 20, 2015, 4:43pm UTC](https://discuss.elastic.co/t/how-to-detect-changes-in-database-and-automatically-adding-new-row-to-elasticsearch-index/23328/1 "2015-04-20T16:43:49Z")

</div>

What I've already done:

I connected my hbase with elasticsearch via this tutorial:

[http://lessc0de.github.io/connecting\_hbase\_to\_elasticsearch.html](http://lessc0de.github.io/connecting_hbase_to_elasticsearch.html)

And I get index with hbase table content, but after adding new row to  
hbase, it is not automatically added to elasticsearch index. I tried to add  
this line to my conf:

"schedule" : "\* 1/5 \* ? \* \*"

and mapping:

"mappings": {  
"jdbc" : {  
"\_id" : {  
"path" : "ID"  
}  
}  
}

which assigns \_id = ID, and ID has unique value in my hbase table.

It's working well: when I add new row to hbase it is uploaded to index in  
less then 5 minutes. But it is not good for performance, because every 5  
minutes it executes a query and doesn't add old content to index only  
because of \_id has to be unique. It is good for small db, but I had over 10  
millions row in my hbase table, so my index is working all time.

It is any solution or plugin to elasticsearch to automatically detected  
changes in db and add only the new row to index?

I create index using:

curl -XPUT 'localhost:9200/\_river/jdbc/\_meta' -d '{  
"type" : "jdbc",  
"jdbc" : {  
"url" : "jdbc:phoenix:localhost",  
"user" : "",  
"password" : "",  
"sql" : "select ID, MESSAGE from test",  
"schedule" : "\* 1/5 \* ? \* \*"  
}  
}'

Thanks for help.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1ea1f467-171a-48cf-8661-1e1dddc8db31%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1ea1f467-171a-48cf-8661-1e1dddc8db31%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:18am UTC](https://discuss.elastic.co/t/how-to-detect-changes-in-database-and-automatically-adding-new-row-to-elasticsearch-index/23328/2 "2017-07-06T00:18:39Z")

</div>


