After installation you are now ready to transfer data from Couchbase Server to Elasticsearch and begin indexing the data. In Elasticsearch you will create an index template to define the scope of indexing and searching. In Couchbase Server, you will change the default setting for replication so that the timing and performance will work with Elasticsearch clusters.
We need to provide an index template that Elasticsearch will use on information from Couchbase. The one we use below is an example provided as part of the Couchbase Plug-in for Elasticsearch:
shell> curl -XPUT http://localhost:9200/_template/couchbase \ -d @plugins/transport-couchbase/couchbase_template.json
You can also provide your own index template in the future. If you provide more than one template, you can maintain multiple indexes that can be individually updated. Upon success, Elasticsearch returns:
For each Couchbase data bucket that we want to search, we create an empty index in Elasticsearch:
shell> curl -XPUT http://localhost:9200/beer-sample
In this case we name our index
beer-sample. Upon success Elasticsearch
returns the following:
Provide this setting to Elasticsearch to change the number of concurrent requests it will handle:
shell>echo "couchbase.maxConcurrentRequests: 1024" >> config/elasticsearch.yml
Stop and restart Elasticsearch for your changes to take effect.
Change the number of concurrent replicators in Couchbase Server from 32 to 8:
shell> curl -X POST -u Administrator:password1 \ http://10.4.2.4:8091/internalSettings \ -d xdcrMaxConcurrentReps=8
When Couchbase Server successfully updates this setting, it will send a response as follows:
HTTP/1.1 200 OK Server: Couchbase Server 2.0.0-1941-rel-community Pragma: no-cache Date: Wed, 28 Nov 2012 18:20:22 GMT Content-Type: application/json Content-Length: 188 Cache-Control: no-cache
One of the issues that can occur when an Elasticsearch node is overwhelmed by replication from Couchbase is that the node can fail. If this does occur, you may also experience errors from remaining nodes.
For more information about this XDCR parameter, see Couchbase Server Manual, Changing Internal XDCR Settings.