module Elasticsearch::API::Cluster::Actions

Public Instance Methods

allocation_explain(arguments = {}) click to toggle source

Provides explanations for shard allocations in the cluster.

@option arguments [Boolean] :include_yes_decisions Return 'YES' decisions in explanation (default: false) @option arguments [Boolean] :include_disk_info Return information about disk usage and shard sizes (default: false) @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The index, shard, and primary flag to explain. Empty means 'explain a randomly-chosen unassigned shard'

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-allocation-explain.html

# File lib/elasticsearch/api/actions/cluster/allocation_explain.rb, line 31
def allocation_explain(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = if arguments[:body]
             Elasticsearch::API::HTTP_POST
           else
             Elasticsearch::API::HTTP_GET
           end

  path   = "_cluster/allocation/explain"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
delete_component_template(arguments = {}) click to toggle source

Deletes a component template

@option arguments [String] :name The name of the template @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-component-template.html

# File lib/elasticsearch/api/actions/cluster/delete_component_template.rb, line 31
def delete_component_template(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_component_template/#{Utils.__listify(_name)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
delete_voting_config_exclusions(arguments = {}) click to toggle source

Clears cluster voting config exclusions.

@option arguments [Boolean] :wait_for_removal Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/voting-config-exclusions.html

# File lib/elasticsearch/api/actions/cluster/delete_voting_config_exclusions.rb, line 29
def delete_voting_config_exclusions(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_cluster/voting_config_exclusions"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
exists_component_template(arguments = {}) click to toggle source

Returns information about whether a particular component template exist

@option arguments [String] :name The name of the template @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-component-template.html

# File lib/elasticsearch/api/actions/cluster/exists_component_template.rb, line 31
def exists_component_template(arguments = {})
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_HEAD
  path   = "_component_template/#{Utils.__listify(_name)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
Also aliased as: exists_component_template?
exists_component_template?(arguments = {})
get_component_template(arguments = {}) click to toggle source

Returns one or more component templates

@option arguments [List] :name The comma separated names of the component templates @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-component-template.html

# File lib/elasticsearch/api/actions/cluster/get_component_template.rb, line 31
def get_component_template(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_GET
  path   = if _name
             "_component_template/#{Utils.__listify(_name)}"
           else
             "_component_template"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
get_settings(arguments = {}) click to toggle source

Returns cluster settings.

@option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Boolean] :include_defaults Whether to return all default clusters setting. @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-get-settings.html

# File lib/elasticsearch/api/actions/cluster/get_settings.rb, line 32
def get_settings(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_cluster/settings"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
health(arguments = {}) click to toggle source

Returns basic information about the health of the cluster.

@option arguments [List] :index Limit the information returned to a specific index @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) @option arguments [String] :level Specify the level of detail for returned information (options: cluster, indices, shards) @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [String] :wait_for_active_shards Wait until the specified number of shards is active @option arguments [String] :wait_for_nodes Wait until the specified number of nodes is available @option arguments [String] :wait_for_events Wait until all currently queued events with the given priority are processed (options: immediate, urgent, high, normal, low, languid) @option arguments [Boolean] :wait_for_no_relocating_shards Whether to wait until there are no relocating shards in the cluster @option arguments [Boolean] :wait_for_no_initializing_shards Whether to wait until there are no initializing shards in the cluster @option arguments [String] :wait_for_status Wait until cluster is in a specific state (options: green, yellow, red) @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-health.html

# File lib/elasticsearch/api/actions/cluster/health.rb, line 40
def health(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = if _index
             "_cluster/health/#{Utils.__listify(_index)}"
           else
             "_cluster/health"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
pending_tasks(arguments = {}) click to toggle source

Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed.

@option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-pending.html

# File lib/elasticsearch/api/actions/cluster/pending_tasks.rb, line 31
def pending_tasks(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_cluster/pending_tasks"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
post_voting_config_exclusions(arguments = {}) click to toggle source

Updates the cluster voting config exclusions by node ids or node names.

@option arguments [String] :node_ids A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names. @option arguments [String] :node_names A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids. @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/voting-config-exclusions.html

# File lib/elasticsearch/api/actions/cluster/post_voting_config_exclusions.rb, line 31
def post_voting_config_exclusions(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_cluster/voting_config_exclusions"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
put_component_template(arguments = {}) click to toggle source

Creates or updates a component template

@option arguments [String] :name The name of the template @option arguments [Boolean] :create Whether the index template should only be added if new or can also replace an existing one @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The template definition (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-component-template.html

# File lib/elasticsearch/api/actions/cluster/put_component_template.rb, line 33
def put_component_template(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_component_template/#{Utils.__listify(_name)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
put_settings(arguments = {}) click to toggle source

Updates the cluster settings.

@option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-update-settings.html

# File lib/elasticsearch/api/actions/cluster/put_settings.rb, line 32
def put_settings(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_PUT
  path   = "_cluster/settings"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body] || {}
  perform_request(method, path, params, body, headers).body
end
remote_info(arguments = {}) click to toggle source

Returns the information about configured remote clusters.

@option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-remote-info.html

# File lib/elasticsearch/api/actions/cluster/remote_info.rb, line 28
def remote_info(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_remote/info"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
reroute(arguments = {}) click to toggle source

Allows to manually change the allocation of individual shards in the cluster.

@option arguments [Boolean] :dry_run Simulate the operation only and return the resulting state @option arguments [Boolean] :explain Return an explanation of why the commands can or cannot be executed @option arguments [Boolean] :retry_failed Retries allocation of shards that are blocked due to too many subsequent allocation failures @option arguments [List] :metric Limit the information returned to the specified metrics. Defaults to all but metadata (options: _all, blocks, metadata, nodes, routing_table, master_node, version) @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The definition of `commands` to perform (`move`, `cancel`, `allocate`)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-reroute.html

# File lib/elasticsearch/api/actions/cluster/reroute.rb, line 35
def reroute(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_cluster/reroute"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body] || {}
  perform_request(method, path, params, body, headers).body
end
state(arguments = {}) click to toggle source

Returns a comprehensive information about the state of the cluster.

@option arguments [List] :metric Limit the information returned to the specified metrics (options: _all, blocks, metadata, nodes, routing_table, routing_nodes, master_node, version) @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Number] :wait_for_metadata_version Wait for the metadata version to be equal or greater than the specified metadata version @option arguments [Time] :wait_for_timeout The maximum time to wait for wait_for_metadata_version before timing out @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed) @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-state.html

# File lib/elasticsearch/api/actions/cluster/state.rb, line 38
def state(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _metric = arguments.delete(:metric)

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = if _metric && _index
             "_cluster/state/#{Utils.__listify(_metric)}/#{Utils.__listify(_index)}"
           elsif _metric
             "_cluster/state/#{Utils.__listify(_metric)}"
           else
             "_cluster/state"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
stats(arguments = {}) click to toggle source

Returns high-level overview of cluster statistics.

@option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes @option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/cluster-stats.html

# File lib/elasticsearch/api/actions/cluster/stats.rb, line 31
def stats(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _node_id = arguments.delete(:node_id)

  method = Elasticsearch::API::HTTP_GET
  path   = if _node_id
             "_cluster/stats/nodes/#{Utils.__listify(_node_id)}"
           else
             "_cluster/stats"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end