Connecting to the cluster

The Couchbase Plug-in for Elasticsearch uses Cross Datacenter Replication (XDCR) feature in Couchbase Server. This feature can transmit all documents from a Couchbase data bucket or server cluster to another cluster. In this case we transmit documents from Couchbase to Elasticsearch using XDCR and as soon and these documents have been transmitted, the Elasticsearch engine will index them.

  1. Open Couchbase web console and login. This is the administrative user interface for Couchbase Server.
  2. Click on the XDCR tab. Under this tab you can configure and start data replication between a source and destination cluster. In this case our source cluster is a Couchbase cluster and the destination is Elasticsearch.
  3. Click on Create Cluster Reference.

    A panel will appear where you can specify information for your Elasticsearch cluster. This is the Elasticsearch cluster where Couchbase Server will send copies of documents from a databucket to be indexed.

  4. Enter a name, hostname, username and password for your Elasticsesarch cluster then click Save.

    Be aware that Elasticsearch will be listening on port 9091 which is not a standard port for those familiar with Couchbase Server.

    The reference to the new replication will appear in the Remote Clusters list under the XDCR Tab.

  5. To set up replication, click Create Replication.

    A panel appears where you can establish replication from your Couchbase cluster to Elasticsearch.

  6. Under Replicate changes from: Bucket, choose beer-sample.
  7. Under the section To: select ElasticSearch.
  8. For Bucket: enter beer-sample. This is actually the Elasticsearch index where the data will be sent for indexing.
  9. If you are using Couchbase Server 2.2 or later, click Advanced settings and change the XDCR Protocol setting to Version 1.
  10. Finally click Replicate to start replication of documents to Elasticsearch. Couchbase Server will begin sending data from the beer-sample bucket to your Elasticsearch cluster.

    Under the Ongoing Replications section, you will see the replication and status of replication.

  11. You can also view the data transfer by clicking the Overview tab of Elasticsearch head:

    The docs field indicates the number of items that have been indexed by Elasticsearch. At this point you can begin querying data from Elasticsearch.

    Note: The number of documents displayed by Elasticsearch head may be greater than the actual number of documents in Couchbase Server. This is because XDCR and the Couchbase Plug-in for Elasticsearch will also send additional documents that describe the status of replication and Elasticsearch head will show this total number. There is an alternate, more accurate way you can determine the true number of documents indexed by Elasticsearch, which excludes extra status documents. You can use this method to debug possible data transfer issues between Couchbase and Elasticsearch.