Class: JayAPI::Elasticsearch::Async
- Inherits:
-
Object
- Object
- JayAPI::Elasticsearch::Async
- Extended by:
- Forwardable
- Defined in:
- lib/jay_api/elasticsearch/async.rb
Overview
Provides functionality to perform asynchronous operations on an elasticsearch index. For more information: ruby-concurrency.github.io/concurrent-ruby/1.3.4/Concurrent
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Instance Method Summary collapse
-
#delete_by_query(query, slices: 5) ⇒ Concurrent::Promise
Deletes asynchronously the documents matching the given query from the Index.
-
#initialize(index) ⇒ Async
constructor
A new instance of Async.
Constructor Details
#initialize(index) ⇒ Async
Returns a new instance of Async.
24 25 26 |
# File 'lib/jay_api/elasticsearch/async.rb', line 24 def initialize(index) @index = index end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
18 19 20 |
# File 'lib/jay_api/elasticsearch/async.rb', line 18 def index @index end |
Instance Method Details
#delete_by_query(query, slices: 5) ⇒ Concurrent::Promise
Deletes asynchronously the documents matching the given query from the Index.
41 42 43 44 45 46 47 48 |
# File 'lib/jay_api/elasticsearch/async.rb', line 41 def delete_by_query(query, slices: 5) Concurrent::Promise.execute do async_response = index.delete_by_query(query, slices: slices, wait_for_completion: false) result = tasks.by_id(async_response[:task]) validate_result(result) result end end |