lib/fluent/plugin/out_solr.rb in fluent-plugin-output-solr-0.4.4 vs lib/fluent/plugin/out_solr.rb in fluent-plugin-output-solr-0.4.5

- old
+ new

@@ -10,10 +10,11 @@ DEFAULT_COLLECTION = 'collection1' DEFAULT_IGNORE_UNDEFINED_FIELDS = false DEFAULT_TAG_FIELD = 'tag' DEFAULT_TIMESTAMP_FIELD = 'event_timestamp' DEFAULT_FLUSH_SIZE = 100 + DEFAULT_COMMIT_WITH_FLUSH = true MODE_STANDALONE = 'Standalone' MODE_SOLRCLOUD = 'SolrCloud' include Fluent::SetTagKeyMixin @@ -43,10 +44,13 @@ :desc => 'A field name of event timestamp in the Solr schema.xml (default event_timestamp).' config_param :flush_size, :integer, :default => DEFAULT_FLUSH_SIZE, :desc => 'A number of events to queue up before writing to Solr (default 100).' + config_param :commit_with_flush, :bool, :default => DEFAULT_COMMIT_WITH_FLUSH, + :desc => 'Send commit command to Solr with flush (default true).' + def initialize super end def configure(conf) @@ -132,13 +136,13 @@ update documents unless documents.empty? end def update(documents) if @mode == MODE_STANDALONE then - @solr.add documents, :params => {:commit => true} + @solr.add documents, :params => {:commit => @commit_with_flush} log.debug "Added %d document(s) to Solr" % documents.count elsif @mode == MODE_SOLRCLOUD then - @solr.add documents, collection: @collection, :params => {:commit => true} + @solr.add documents, collection: @collection, :params => {:commit => @commit_with_flush} log.debug "Update: Added %d document(s) to Solr" % documents.count end rescue Exception => e log.warn "Update: An error occurred while indexing: #{e.message}" end