Class: LogStash::Modules::ElasticsearchImporter

Inherits:
Object
  • Object
show all
Includes:
Util::Loggable
Defined in:
lib/logstash/modules/elasticsearch_importer.rb

Instance Method Summary collapse

Methods included from Util::Loggable

included, #logger, #slow_logger

Constructor Details

#initialize(client) ⇒ ElasticsearchImporter

Returns a new instance of ElasticsearchImporter.



8
9
10
# File 'lib/logstash/modules/elasticsearch_importer.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#put(resource, overwrite = true) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/logstash/modules/elasticsearch_importer.rb', line 12

def put(resource, overwrite = true)
  path = resource.import_path
  logger.debug("Attempting PUT", :url_path => path, :file_path => resource.content_path)
  if !overwrite && content_exists?(path)
    logger.debug("Found existing Elasticsearch resource.", :resource => path)
    return
  end
  put_overwrite(path, resource.content)
end