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.



111
112
113
114
115
116
117
# File 'lib/logstash/outputs/elasticsearch/protocol.rb', line 111

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

Instance Method Details

#bulk(actions) ⇒ Object

def build_client



184
185
186
187
188
189
190
191
192
193
# File 'lib/logstash/outputs/elasticsearch/protocol.rb', line 184

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()

  # TODO(sissel): What format should the response be in?
end