Class: LogStash::Outputs::Elasticsearch::Protocols::NodeClient

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/outputs/elasticsearch/protocol.rb

Overview

class HTTPClient

Direct Known Subclasses

TransportClient

Instance Method Summary collapse

Methods inherited from Base

#template_install

Constructor Details

#initialize(options = {}) ⇒ NodeClient

Returns a new instance of NodeClient.



153
154
155
156
157
158
159
# File 'lib/logstash/outputs/elasticsearch/protocol.rb', line 153

def initialize(options={})
  super
  require "java"
  @options = DEFAULT_OPTIONS.merge(options)
  setup(@options)
  @client = client
end

Instance Method Details

#bulk(actions) ⇒ Object



239
240
241
242
243
244
245
246
247
248
# File 'lib/logstash/outputs/elasticsearch/protocol.rb', line 239

def bulk(actions)
  # Actions an array of [ action, action_metadata, source ]
  prep = @client.prepareBulk
  actions.each do |action, args, source|
    prep.add(build_request(action, args, source))
  end
  response = prep.execute.actionGet()

  self.class.normalize_bulk_response(response)
end