Sha256: ff98c42f57f910a36c3d76041714286a36fa8f33933e8f9f9df12b1538131ad1
Contents?: true
Size: 943 Bytes
Versions: 68
Compression:
Stored size: 943 Bytes
Contents
# encoding: utf-8 require "logstash/namespace" require "logstash/logging" module LogStash module Modules class ElasticsearchImporter include LogStash::Util::Loggable def initialize(client) @client = client end 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 private def put_overwrite(path, content) if content_exists?(path) response = @client.delete(path) end # hmmm, versioning? @client.put(path, content).status == 201 end def content_exists?(path) response = @client.head(path) response.status >= 200 && response.status < 300 end end end end # class LogStash::Modules::Importer
Version data entries
68 entries across 68 versions & 5 rubygems