Elasticsearch provides powerful search capabilities with support for sharding and replication of the data. So we would want to index data available in our DB into Elasticsearch.
There are multiple ways to index data into Elasticsearch:
- Use Logstash to setup source as DB and sink as Elasticsearch and use a filter if required to build JSON object.
- Use an external library elasticsearch-jdbc which runs, in its own process, external to Elasticsearch instance. It makes use of the transport client and its bulk APIs to index data into Elasticsearch.
In this article, we will look at the approach 2 i.e using an external library running as a separate process.