Method: SolrUtil#update_core

Defined in:
lib/fluent/plugin/solr_util.rb

#update_core(chunk, core) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fluent/plugin/solr_util.rb', line 7

def update_core(chunk, core)
  documents = []

  chunk.msgpack_each do |tag, unixtime, record|
    time = Time.at(unixtime)
    time = time.utc unless @localtime
    record.merge!(@time_field => time.strftime('%FT%TZ'))
    record.merge!(@tag_key    => tag) if @include_tag_key
    documents << record
    if documents.count >= @send_rate
      update_core_request(documents)
      documents = []
    end
  end

  update_core_request(documents) if documents.count > 0
end