Class: ElastomerClient::Client::Reindex

Inherits:
Object
  • Object
show all
Defined in:
lib/elastomer_client/client/reindex.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Reindex

Create a new Reindex for initiating reindex tasks. More context: www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html

client - ElastomerClient::Client used for HTTP requests to the server



16
17
18
# File 'lib/elastomer_client/client/reindex.rb', line 16

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



20
21
22
# File 'lib/elastomer_client/client/reindex.rb', line 20

def client
  @client
end

Instance Method Details

#reindex(body, params = {}) ⇒ Object



22
23
24
25
# File 'lib/elastomer_client/client/reindex.rb', line 22

def reindex(body, params = {})
  response = client.post "/_reindex", params.merge(params, body:, action: "reindex", rest_api: "reindex")
  response.body
end

#rethrottle(task_id, params = {}) ⇒ Object



27
28
29
30
# File 'lib/elastomer_client/client/reindex.rb', line 27

def rethrottle(task_id, params = {})
  response = client.post "/_reindex/#{task_id}/_rethrottle", params.merge(params, action: "rethrottle", rest_api: "reindex")
  response.body
end