Class: JayAPI::Elasticsearch::Tasks

Inherits:
Object
  • Object
show all
Defined in:
lib/jay_api/elasticsearch/tasks.rb

Overview

Represents Elasticsearch tasks. Returns information about the tasks currently executing in the cluster. TODO: Add #all [JAY-593]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tasks

Returns a new instance of Tasks.

Parameters:



16
17
18
# File 'lib/jay_api/elasticsearch/tasks.rb', line 16

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



12
13
14
# File 'lib/jay_api/elasticsearch/tasks.rb', line 12

def client
  @client
end

Instance Method Details

#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

Examples:

Returned Hash can be found in this method’s unit tests

Parameters:

  • task_id (String)

    The ID of the task whose info is needed

Returns:

  • (Hash)

    A Hash that details the results of the operation defined by task_id

Raises:

  • (Elasticsearch::Transport::Transport::ServerError)

    If the query fails.



31
32
33
# File 'lib/jay_api/elasticsearch/tasks.rb', line 31

def by_id(task_id)
  client.task_by_id(task_id: task_id, wait_for_completion: true).deep_symbolize_keys
end