Sha256: 1f3382b33d36e3bfa0c6d9b2ccd7effe822446ab0edae9ee983b386cc0b75d24

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

events=[{id:22}]
@solr_url="a"
documents = Hash.new  #this is the array of hashes that we push to Solr as documents

events.each do |event|
    url = @solr_url
    if documents[url].nil?
        documents[url]=[]
    end
    document = event.to_hash()
    if @document_id.nil?
        document ["id"] =  "UUIDTools::UUID.random_create"    #add a unique ID
    else
        document ["id"] = @document_id      #or use the one provided
    end
    documents[url].push(document)
end

documents.keys.each do |url|
    #solr = RSolr.connect :url => url
    #solr.add(documents[url])
    puts documents[url]
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mantis-logstash-output-solr_http-3.0.5.m3 lib/logstash/outputs/test.rb
mantis-logstash-output-solr_http-3.0.5.m2 lib/logstash/outputs/test.rb