Search:

Search all manuals
Search this manual
Manual
Couchbase Plug-in for Elasticsearch
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
Couchbase Plug-in for Elasticsearch
Child Sections
Chapters

Chapter 3. Indexing and Querying Data

Table of Contents

3.1. Querying Data
3.2. Document Design Considerations

The Couchbase Plug-in for Elasticsearch uses Cross Datacenter Replication (XDCR) feature in Couchbase Server 2.0. 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. For more information about XDCR in Couchbase Server 2.0, see Couchbase Server Manual, Cross Datacenter Replication:

  1. Open Couchbase Web Console and login. This is the administrative user interface for Couchbase Server. For more information, see Couchbase Server Manual.

  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.

    Figure 3.1. Create Reference for Replication

    Create Reference for Replication

    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. 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.

    Figure 3.2. Create Reference for Replication

    Create Reference for Replication

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

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

    Figure 3.3. View Replication

    View Replication

    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 that 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. For more information, see Chapter 4, Monitoring and Troubleshooting, Compare Document Count.