Class: JayAPI::Elasticsearch::Tasks
- Inherits:
-
Object
- Object
- JayAPI::Elasticsearch::Tasks
- Extended by:
- Forwardable
- Includes:
- Mixins::RetriableRequests
- Defined in:
- lib/jay_api/elasticsearch/tasks.rb
Overview
Represents Elasticsearch tasks. Returns information about the tasks currently executing in the cluster.
Constant Summary
Constants included from Mixins::RetriableRequests
Mixins::RetriableRequests::NON_RETRIABLE_ERRORS, Mixins::RetriableRequests::RETRIABLE_ERRORS
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#all(actions: nil, detailed: false) ⇒ Hash
Gets the list of tasks running on the Elasticsearch cluster.
-
#by_id(task_id) ⇒ Hash
Retrieves info about the task with the passed
task_idFor more information on how to build the query please refer to the Elasticsearch DSL documentation: www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#tasks-api-query-params. -
#initialize(client:) ⇒ Tasks
constructor
A new instance of Tasks.
Methods included from Mixins::RetriableRequests
#logger, #max_attempts, #non_retriable_errors, #retriable_errors, #wait_strategy
Constructor Details
#initialize(client:) ⇒ Tasks
Returns a new instance of Tasks.
24 25 26 |
# File 'lib/jay_api/elasticsearch/tasks.rb', line 24 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
18 19 20 |
# File 'lib/jay_api/elasticsearch/tasks.rb', line 18 def client @client end |
Instance Method Details
#all(actions: nil, detailed: false) ⇒ Hash
Gets the list of tasks running on the Elasticsearch cluster. For more information about this endpoint and the parameters please see: www.elastic.co/docs/api/doc/elasticsearch/operation/operation-tasks-list
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/jay_api/elasticsearch/tasks.rb', line 38 def all(actions: nil, detailed: false) # Needed because unlike many Elasticsearch methods Tasks#list doesn't # call #listify over +actions+. actions = actions&.then do |value| value.is_a?(Array) ? value.join(',') : value end retry_request do tasks_client.list({ actions:, detailed: }.compact_blank) end end |
#by_id(task_id) ⇒ Hash
Retrieves info about the task with the passed task_id For more information on how to build the query please refer to the Elasticsearch DSL documentation: www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#tasks-api-query-params
61 62 63 64 65 |
# File 'lib/jay_api/elasticsearch/tasks.rb', line 61 def by_id(task_id) retry_request do tasks_client.get(task_id:, wait_for_completion: true).deep_symbolize_keys end end |