As shown in the figure below, the application uses the Couchbase Server SDKs to query Couchbase Server and the Elasticsearch query DSL APIs to query Elasticsearch.
The plug-in is installed on the Elasticsearch cluster and uses Couchbase’s cross datacenter replication (XDCR) to propagate document updates made in Couchbase to Elasticsearch. The search index on the Elasticsearch cluster is always kept up to date with the data in Couchbase.
To search across all your documents, you can use the Elasticsearch query DSL. You get back document IDs for relevant documents. You can directly access documents in Couchbase to retrieve document content.
Based on the requirements of your application for Couchbase and Elasticsearch, you can scale the Couchbase and Elasticsearch clusters independently – the clusters can both have different number of servers.
The installation process for the Couchbase plug-in for Elasticsearch is fairly straightforward. To get started with Couchbase Server and Elasticsearch:
Download the required prerequisites
Install the plug-ins using the following steps:
Go to the install directory for Elasticsearch
Install the Couchbase plug-in
bin/plugin -install couchbaselabs/elasticsearch-transport-couchbase/1.0.0-dp
After a successful install, the plugin installer returns:
DONE Installed transport-couchbase
Set the Couchbase credentials for the plug-in
echo "couchbase.password: password" >> config/elasticsearch.yml
echo "couchbase.username: Administrator" >> config/elasticsearch.yml
Install the head Elasticsearch plug-in which provides a simple user interface so that you can interact with Elasticsearch
bin/plugin -install mobz/elasticsearch-head
Start the Elasticsearch process. The Elasticsearch process will run in the background.
Configure the Couchbase plug-in for Elasticsearch
Setup cross-datacenter replication from Couchbase to Elasticsearch
Here are some more resources to help you get started: