Skip to content

Commit

Permalink
Merge with upstream master
Browse files Browse the repository at this point in the history
  • Loading branch information
bignolip committed Nov 27, 2015
2 parents 1579139 + 948d0d1 commit 8694cd6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ In the File menu of the "Policy Tool" window, Save the changes. Close the <code
- **couchbase.ignoreFailures** - Enabling this flag will cause the plugin to return a success status to Couchbase even if it cannot index some of the documents. This will prevent the XDCR replication from being stalled due to indexing errors in ElasticSearch, for example when a schema change breaks some of the ES type mappings. Default is `false`.
- **couchbase.ignoreDeletes** - Specifying one or more index names (as a comma or semicolon delimited string) here will cause the plugin to ignore document deletion and expiration for those indexes. This can be used to turn ElasticSearch into a sort of searchable archive for a Couchbase bucket. Note that this also means that the index will continue to grow indefinitely.
- **couchbase.wrapCounters** - Enabling this flag will cause the plugin to wrap integer values from Couchbase, which are not valid JSON documents, in a simple document before indexing them in ElasticSearch. The resulting document is in the format `{ "value" : <value> }` and is stored under the ID of the original value from Couchbase.
- **couchbase.ignoreDotIndexes** - Enabled by default (`true`). Causes the plugin to completely ignore indexes whose name starts with ".", such as ".kibana", ".marvel", etc.
- **couchbase.includeIndexes** - Specifying one or more index names (as a comma or semicolon delimited string) here will cause the plugin to ignore the existence of all other indexes. For example, if you have only a few indexes replicated from Couchbase, there's no reason to store checkpoint metadata in all other indexes.
- **couchbase.ignoreDotIndexes** - Enabled by default (`true`). Causes the plugin to completely ignore indexes/aliases whose name starts with ".", such as ".kibana", ".marvel", etc.
- **couchbase.includeIndexes** - Specifying one or more index/alias names (as a comma or semicolon delimited string) here will cause the plugin to ignore the existence of all other indexes. For example, if you have only a few indexes replicated from Couchbase, there's no reason to store checkpoint metadata in all other indexes. Note that this setting takes precedence over ignoreDotIndexes, so if you whitelist an index or alias that starts with a dot, the plugin will use it.

### Mapping Couchbase documents to ElasticSearch types ###

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ public List<String> getBucketsInPool(String pool) {
ClusterStateResponse response = stateBuilder.execute().actionGet();
ImmutableOpenMap<String, IndexMetaData> indices = response.getState().getMetaData().getIndices();
for (ObjectCursor<String> index : indices.keys()) {
if(shouldIgnoreBucket(index.value)) // Don't include buckets on the ignore list
continue;
if(!shouldIgnoreBucket(index.value)) // Don't include indexes on the ignore list
bucketNameList.add(index.value);

bucketNameList.add(index.value);
IndexMetaData indexMetaData = indices.get(index.value);
ImmutableOpenMap<String, AliasMetaData> aliases = indexMetaData.getAliases();
for(ObjectCursor<String> alias : aliases.keys()) {
bucketNameList.add(alias.value);
if(!shouldIgnoreBucket(alias.value)) // Don't include aliases on the ignore list
bucketNameList.add(alias.value);
}
}

Expand All @@ -115,11 +115,18 @@ public List<String> getBucketsInPool(String pool) {
}

protected Boolean shouldIgnoreBucket(String bucketName) {
return bucketName == null ||
(pluginSettings.getIgnoreDotIndexes() && bucketName.startsWith(".")) ||
(pluginSettings.getIncludeIndexes() != null &&
pluginSettings.getIncludeIndexes().size() > 0 &&
!pluginSettings.getIncludeIndexes().contains(bucketName));
if(bucketName == null)
return true;

// The includeIndexes setting takes precedence over ignoreDotIndexes
if(pluginSettings.getIncludeIndexes() != null &&
pluginSettings.getIncludeIndexes().size() > 0)
return !pluginSettings.getIncludeIndexes().contains(bucketName);

if(pluginSettings.getIgnoreDotIndexes() && bucketName.startsWith("."))
return true;

return false;
}

protected String getUUIDFromCheckpointDocSource(Map<String, Object> source) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public String toString() {
", keyFilter=" + keyFilter.getClass().getCanonicalName() +
", documentTypeRoutingFields=" + documentTypeRoutingFields +
", ignoreDeletes=" + ignoreDeletes +
", includeIndexes=" + includeIndexes +
'}';
}

Expand Down

0 comments on commit 8694cd6

Please sign in to comment.