Repository: incubator-streams Updated Branches: refs/heads/STREAMS-206 [created] 1ee614e77
resolves STREAMS-206, pending feedback Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/1ee614e7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/1ee614e7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/1ee614e7 Branch: refs/heads/STREAMS-206 Commit: 1ee614e77d8fa16cc58aec689d5d7716a8e29026 Parents: eec3aa9 Author: sblackmon <[email protected]> Authored: Thu Oct 30 11:48:15 2014 -0500 Committer: sblackmon <[email protected]> Committed: Thu Oct 30 11:48:15 2014 -0500 ---------------------------------------------------------------------- .../elasticsearch/processor/PercolateTagProcessor.java | 10 ++++++---- .../elasticsearch/ElasticsearchWriterConfiguration.json | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/1ee614e7/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/processor/PercolateTagProcessor.java ---------------------------------------------------------------------- diff --git a/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/processor/PercolateTagProcessor.java b/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/processor/PercolateTagProcessor.java index 0b62ce9..ca9be8d 100644 --- a/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/processor/PercolateTagProcessor.java +++ b/streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/processor/PercolateTagProcessor.java @@ -202,9 +202,11 @@ public class PercolateTagProcessor implements StreamsProcessor { manager = new ElasticsearchClientManager(config); bulkBuilder = manager.getClient().prepareBulk(); createIndexIfMissing(config.getIndex()); - deleteOldQueries(config.getIndex()); + if( config.getReplaceTags() == true ) { + deleteOldQueries(config.getIndex()); + } for (String tag : config.getTags().getAdditionalProperties().keySet()) { - String query = (String)config.getTags().getAdditionalProperties().get(tag); + String query = (String) config.getTags().getAdditionalProperties().get(tag); PercolateQueryBuilder queryBuilder = new PercolateQueryBuilder(tag, query, this.usePercolateField); addPercolateRule(queryBuilder, config.getIndex()); } @@ -213,12 +215,12 @@ public class PercolateTagProcessor implements StreamsProcessor { else LOGGER.error("FAILED writing " + bulkBuilder.numberOfActions() + " tags to " + config.getIndex() + " _percolator"); - } @Override public void cleanUp() { - deleteOldQueries(config.getIndex()); + if( config.getCleanupTags() == true ) + deleteOldQueries(config.getIndex()); manager.getClient().close(); } http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/1ee614e7/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchWriterConfiguration.json ---------------------------------------------------------------------- diff --git a/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchWriterConfiguration.json b/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchWriterConfiguration.json index 13017e2..603b0bf 100644 --- a/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchWriterConfiguration.json +++ b/streams-contrib/streams-persist-elasticsearch/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchWriterConfiguration.json @@ -41,6 +41,16 @@ "javaInterfaces": ["java.io.Serializable"], "description": "Tags to apply during index" }, + "replaceTags": { + "type": "boolean", + "description": "Whether to overwrite _percolator rules on startup", + "default": true + }, + "cleanupTags": { + "type": "boolean", + "description": "Whether to remove _percolator rules on shutdown", + "default": true + }, "forceUseConfig": { "type": "boolean", "description": "Whether or not we force the values that are set in the configuration"
