Class: ElasticSearch::Request
- Inherits:
-
Object
- Object
- ElasticSearch::Request
- Defined in:
- lib/jruby-elasticsearch/request.rb
Direct Known Subclasses
BulkRequest, DeleteIndexTemplateRequest, GetIndexTemplatesRequest, IndexRequest, PutIndexTemplateRequest, SearchRequest
Instance Method Summary collapse
-
#initialize ⇒ Request
constructor
Create a new index request.
-
#on(event, &block) ⇒ Object
See ElasticSearch::ActionListener#on.
-
#use_callback(&block) ⇒ Object
Execute this index request.
Constructor Details
#initialize ⇒ Request
Create a new index request.
6 7 8 |
# File 'lib/jruby-elasticsearch/request.rb', line 6 def initialize @handler = ElasticSearch::ActionListener.new end |
Instance Method Details
#on(event, &block) ⇒ Object
See ElasticSearch::ActionListener#on
11 12 13 14 15 |
# 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) ⇒ Object
Execute this index request. This call is asynchronous.
If a block is given, register it for both failure and success.
21 22 23 24 25 26 |
# File 'lib/jruby-elasticsearch/request.rb', line 21 def use_callback(&block) if block_given? on(:failure, &block) on(:success, &block) end end |