class ElasticSearch::Request

Public Class Methods

new() click to toggle source

Create a new index request.

# File lib/jruby-elasticsearch/request.rb, line 6
def initialize
  @handler = ElasticSearch::ActionListener.new
end

Public Instance Methods

on(event, &block) click to toggle source

See ElasticSearch::ActionListener#on

# File lib/jruby-elasticsearch/request.rb, line 11
def on(event, &block)
  #puts "Event[#{event}] => #{block} (#{@handler})"
  @handler.on(event, &block)
  return self
end
use_callback(&block) click to toggle source

Execute this index request. This call is asynchronous.

If a block is given, register it for both failure and success.

# File lib/jruby-elasticsearch/request.rb, line 21
def use_callback(&block)
  if block_given?
    on(:failure, &block)
    on(:success, &block)
  end
end