module Elasticsearch::API::Indices::Actions

Public Instance Methods

add_block(arguments = {}) click to toggle source

Adds a block to an index.

@option arguments [List] :index A comma separated list of indices to add a block to @option arguments [String] :block The block to add (one of read, write, read_only or metadata) @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @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/index-modules-blocks.html

# File lib/elasticsearch/api/actions/indices/add_block.rb, line 35
def add_block(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
  raise ArgumentError, "Required argument 'block' missing" unless arguments[:block]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _block = arguments.delete(:block)

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

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

Performs the analysis process on a text and return the tokens breakdown of the text.

@option arguments [String] :index The name of the index to scope the operation @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Define analyzer/tokenizer parameters and the text on which the analysis should be performed

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

# File lib/elasticsearch/api/actions/indices/analyze.rb, line 30
def analyze(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  path   = if _index
             "#{Utils.__listify(_index)}/_analyze"
           else
             "_analyze"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

Clears all or specific caches for one or more indices.

@option arguments [List] :index A comma-separated list of index name to limit the operation @option arguments [Boolean] :fielddata Clear field data @option arguments [List] :fields A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) @option arguments [Boolean] :query Clear query caches @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 [Boolean] :request Clear request cache @option arguments [Hash] :headers Custom HTTP headers

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

# File lib/elasticsearch/api/actions/indices/clear_cache.rb, line 36
def clear_cache(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Clones an index

@option arguments [String] :index The name of the source index to clone @option arguments [String] :target The name of the target index to clone into @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the cloned index before the operation returns. @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-clone-index.html

# File lib/elasticsearch/api/actions/indices/clone.rb, line 34
def clone(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
  raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _target = arguments.delete(:target)

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

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

Closes an index.

@option arguments [List] :index A comma separated list of indices to close @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @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 [String] :wait_for_active_shards Sets the number of active shards to wait for before the operation returns. Set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. Defaults to `0`. @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-open-close.html

# File lib/elasticsearch/api/actions/indices/close.rb, line 35
def close(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "#{Utils.__listify(_index)}/_close"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

Creates an index with optional settings and mappings.

@option arguments [String] :index The name of the index @option arguments [Boolean] :include_type_name Whether a type should be expected in the body of the mappings. @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for before the operation returns. @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 configuration for the index (`settings` and `mappings`)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-create-index.html

# File lib/elasticsearch/api/actions/indices/create.rb, line 34
def create(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Deletes an index.

@option arguments [List] :index A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Boolean] :ignore_unavailable Ignore unavailable indexes (default: false) @option arguments [Boolean] :allow_no_indices Ignore if a wildcard expression resolves to no concrete indices (default: false) @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open, closed, or hidden indices (options: open, closed, hidden, none, all) @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-delete-index.html

# File lib/elasticsearch/api/actions/indices/delete.rb, line 34
def delete(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
delete_alias(arguments = {}) click to toggle source

Deletes an alias.

@option arguments [List] :index A comma-separated list of index names (supports wildcards); use `_all` for all indices @option arguments [List] :name A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. @option arguments [Time] :timeout Explicit timestamp for the document @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-aliases.html

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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _name = arguments.delete(:name)

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

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

Deletes an index 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-templates.html

# File lib/elasticsearch/api/actions/indices/delete_index_template.rb, line 31
def delete_index_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   = "_index_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_template(arguments = {}) click to toggle source

Deletes an index 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-templates.html

# File lib/elasticsearch/api/actions/indices/delete_template.rb, line 31
def delete_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   = "_template/#{Utils.__listify(_name)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
disk_usage(arguments = {}) click to toggle source

Analyzes the disk usage of each field of an index or data stream This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

@option arguments [String] :index Comma-separated list of indices or data streams to analyze the disk usage @option arguments [Boolean] :run_expensive_tasks Must be set to [true] in order for the task to be performed. Defaults to false. @option arguments [Boolean] :flush Whether flush or not before analyzing the index disk usage. Defaults to true @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/indices-disk-usage.html

# File lib/elasticsearch/api/actions/indices/disk_usage.rb, line 38
def disk_usage(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "#{Utils.__listify(_index)}/_disk_usage"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

Returns information about whether a particular index exists.

@option arguments [List] :index A comma-separated list of index names @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Boolean] :ignore_unavailable Ignore unavailable indexes (default: false) @option arguments [Boolean] :allow_no_indices Ignore if a wildcard expression resolves to no concrete indices (default: false) @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all) @option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Boolean] :include_defaults Whether to return all default setting for each of the indices. @option arguments [Hash] :headers Custom HTTP headers

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

# File lib/elasticsearch/api/actions/indices/exists.rb, line 35
def exists(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body, headers).status == 200 ? true : false
  end
end
Also aliased as: exists?
exists?(arguments = {})
Alias for: exists
exists_alias(arguments = {}) click to toggle source

Returns information about whether a particular alias exists.

@option arguments [List] :name A comma-separated list of alias names to return @option arguments [List] :index A comma-separated list of index names to filter aliases @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 [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-aliases.html

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

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

  _index = arguments.delete(:index)

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

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body, headers).status == 200 ? true : false
  end
end
Also aliased as: exists_alias?
exists_alias?(arguments = {})
Alias for: exists_alias
exists_index_template(arguments = {}) click to toggle source

Returns information about whether a particular index template exists.

@option arguments [String] :name The name of the template @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 [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-templates.html

# File lib/elasticsearch/api/actions/indices/exists_index_template.rb, line 32
def exists_index_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   = "_index_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_index_template?
exists_index_template?(arguments = {})
exists_template(arguments = {}) click to toggle source

Returns information about whether a particular index template exists.

@option arguments [List] :name The comma separated names of the index templates @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 [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-templates.html

# File lib/elasticsearch/api/actions/indices/exists_template.rb, line 32
def exists_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   = "_template/#{Utils.__listify(_name)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body, headers).status == 200 ? true : false
  end
end
Also aliased as: exists_template?
exists_template?(arguments = {})
Alias for: exists_template
exists_type(arguments = {}) click to toggle source

Returns information about whether a particular document type exists. (DEPRECATED)

@option arguments [List] :index A comma-separated list of index names; use `_all` to check the types across all indices @option arguments [List] :type A comma-separated list of document types to check @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 [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-types-exists.html

# File lib/elasticsearch/api/actions/indices/exists_type.rb, line 34
def exists_type(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
  raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

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

  body = nil

  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body, headers).status == 200 ? true : false
  end
end
Also aliased as: exists_type?
exists_type?(arguments = {})
Alias for: exists_type
field_usage_stats(arguments = {}) click to toggle source

Returns the field usage stats for each field of an index This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

@option arguments [String] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices @option arguments [List] :fields A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards) @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/field-usage-stats.html

# File lib/elasticsearch/api/actions/indices/field_usage_stats.rb, line 37
def field_usage_stats(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Performs the flush operation on one or more indices.

@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices @option arguments [Boolean] :force Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) @option arguments [Boolean] :wait_if_ongoing If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running. @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/indices-flush.html

# File lib/elasticsearch/api/actions/indices/flush.rb, line 34
def flush(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Performs a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead

@option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices @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, none, all) @option arguments [Hash] :headers Custom HTTP headers

*Deprecation notice*: Synced flush is deprecated and will be removed in 8.0. Use flush instead. Deprecated since version 7.6.0

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-synced-flush-api.html

# File lib/elasticsearch/api/actions/indices/flush_synced.rb, line 37
def flush_synced(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  body = nil
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end
forcemerge(arguments = {}) click to toggle source

Performs the force merge operation on one or more indices.

@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] :flush Specify whether the index should be flushed after performing the operation (default: true) @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 [Number] :max_num_segments The number of segments the index should be merged into (default: dynamic) @option arguments [Boolean] :only_expunge_deletes Specify whether the operation should only expunge deleted documents @option arguments [Hash] :headers Custom HTTP headers

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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Returns information about one or more indices.

@option arguments [List] :index A comma-separated list of index names @option arguments [Boolean] :include_type_name Whether to add the type name to the response (default: false) @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Boolean] :ignore_unavailable Ignore unavailable indexes (default: false) @option arguments [Boolean] :allow_no_indices Ignore if a wildcard expression resolves to no concrete indices (default: false) @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all) @option arguments [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Boolean] :include_defaults Whether to return all default setting for each of the indices. @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-get-index.html

# File lib/elasticsearch/api/actions/indices/get.rb, line 37
def get(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Returns an alias.

@option arguments [List] :name A comma-separated list of alias names to return @option arguments [List] :index A comma-separated list of index names to filter aliases @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 [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-aliases.html

# File lib/elasticsearch/api/actions/indices/get_alias.rb, line 34
def get_alias(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

  _index = arguments.delete(:index)

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

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

Returns mapping for one or more fields.

@option arguments [List] :fields A comma-separated list of fields @option arguments [List] :index A comma-separated list of index names @option arguments [List] :type A comma-separated list of document types Deprecated @option arguments [Boolean] :include_type_name Whether a type should be returned in the body of the mappings. @option arguments [Boolean] :include_defaults Whether the default mapping values should be returned as well @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 [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Hash] :headers Custom HTTP headers

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-get-field-mapping.html

# File lib/elasticsearch/api/actions/indices/get_field_mapping.rb, line 42
def get_field_mapping(arguments = {})
  _fields = arguments.delete(:field) || arguments.delete(:fields)
  raise ArgumentError, "Required argument 'field' missing" unless _fields

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

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

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

Returns an index template.

@option arguments [List] :name The comma separated names of the index templates @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 [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-templates.html

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

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

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

Returns mappings for one or more indices.

@option arguments [List] :index A comma-separated list of index names @option arguments [List] :type A comma-separated list of document types Deprecated @option arguments [Boolean] :include_type_name Whether to add the type name to the response (default: false) @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 [Time] :master_timeout Specify timeout for connection to master @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) Deprecated @option arguments [Hash] :headers Custom HTTP headers

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-get-mapping.html

# File lib/elasticsearch/api/actions/indices/get_mapping.rb, line 41
def get_mapping(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

  method = Elasticsearch::API::HTTP_GET
  path   = if _index && _type
             "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}"
           elsif _index
             "#{Utils.__listify(_index)}/_mapping"
           elsif _type
             "_mapping/#{Utils.__listify(_type)}"
           else
             "_mapping"
           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 settings for one or more indices.

@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 [List] :name The name of the settings that should be included @option arguments [Time] :master_timeout Specify timeout for connection to master @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 [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Boolean] :include_defaults Whether to return all default setting for each of the indices. @option arguments [Hash] :headers Custom HTTP headers

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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _name = arguments.delete(:name)

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

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

Returns an index template.

@option arguments [List] :name The comma separated names of the index templates @option arguments [Boolean] :include_type_name Whether a type should be returned in the body of the mappings. @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 [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-templates.html

# File lib/elasticsearch/api/actions/indices/get_template.rb, line 33
def get_template(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

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

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

DEPRECATED Returns a progress status of current upgrade.

@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] :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

*Deprecation notice*: The _upgrade API is no longer useful and will be removed. Instead, see _reindex API. Deprecated since version 8.0.0

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

# File lib/elasticsearch/api/actions/indices/get_upgrade.rb, line 37
def get_upgrade(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Opens an index.

@option arguments [List] :index A comma separated list of indices to open @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @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 [String] :wait_for_active_shards Sets the number of active shards to wait for before the operation returns. @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-open-close.html

# File lib/elasticsearch/api/actions/indices/open.rb, line 35
def open(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "#{Utils.__listify(_index)}/_open"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

Creates or updates an alias.

@option arguments [List] :index A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. @option arguments [String] :name The name of the alias to be created or updated @option arguments [Time] :timeout Explicit timestamp for the document @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The settings for the alias, such as `routing` or `filter`

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

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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _name = arguments.delete(:name)

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

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

Creates or updates an index 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 [String] :cause User defined reason for creating/updating the index template @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-templates.html

# File lib/elasticsearch/api/actions/indices/put_index_template.rb, line 33
def put_index_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   = "_index_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_mapping(arguments = {}) click to toggle source

Updates the index mappings.

@option arguments [List] :index A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. @option arguments [String] :type The name of the document type Deprecated @option arguments [Boolean] :include_type_name Whether a type should be expected in the body of the mappings. @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @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 [Boolean] :write_index_only When true, applies mappings only to the write index of an alias or data stream @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The mapping definition (Required)

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-put-mapping.html

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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

  method = Elasticsearch::API::HTTP_PUT
  path   = if _index && _type
             "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_mappings"
           elsif _index
             "#{Utils.__listify(_index)}/_mappings"
           elsif _type
             "_mappings/#{Utils.__listify(_type)}"
           end
  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 index settings.

@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 [Time] :master_timeout Specify timeout for connection to master @option arguments [Time] :timeout Explicit operation timeout @option arguments [Boolean] :preserve_existing Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` @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 [Boolean] :flat_settings Return settings in flat format (default: false) @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The index settings to be updated (Required)

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

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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Creates or updates an index template.

@option arguments [String] :name The name of the template @option arguments [Boolean] :include_type_name Whether a type should be returned in the body of the mappings. @option arguments [Number] :order The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) @option arguments [Boolean] :create Whether the index template should only be added if new or can also replace an existing one @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-templates.html

# File lib/elasticsearch/api/actions/indices/put_template.rb, line 34
def put_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   = "_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
recovery(arguments = {}) click to toggle source

Returns information about ongoing index shard recoveries.

@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] :detailed Whether to display detailed information about shard recovery @option arguments [Boolean] :active_only Display only those recoveries that are currently on-going @option arguments [Hash] :headers Custom HTTP headers

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

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Performs the refresh operation in one or more indices.

@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] :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/indices-refresh.html

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Returns information about any matching indices, aliases, and data streams This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

@option arguments [List] :name A comma-separated list of names or wildcard expressions @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all) @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-resolve-index-api.html

# File lib/elasticsearch/api/actions/indices/resolve_index.rb, line 34
def resolve_index(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_GET
  path   = "_resolve/index/#{Utils.__listify(_name)}"
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

Updates an alias to point to a new index when the existing index is considered to be too large or too old.

@option arguments [String] :alias The name of the alias to rollover @option arguments [String] :new_index The name of the rollover index @option arguments [Boolean] :include_type_name Whether a type should be included in the body of the mappings. @option arguments [Time] :timeout Explicit operation timeout @option arguments [Boolean] :dry_run If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the newly created rollover index before the operation returns. @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The conditions that needs to be met for executing rollover

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-rollover-index.html

# File lib/elasticsearch/api/actions/indices/rollover.rb, line 37
def rollover(arguments = {})
  raise ArgumentError, "Required argument 'alias' missing" unless arguments[:alias]

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

  arguments = arguments.clone

  _alias = arguments.delete(:alias)

  _new_index = arguments.delete(:new_index)

  method = Elasticsearch::API::HTTP_POST
  path   = if _alias && _new_index
             "#{Utils.__listify(_alias)}/_rollover/#{Utils.__listify(_new_index)}"
           else
             "#{Utils.__listify(_alias)}/_rollover"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

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

Provides low-level information about segments in a Lucene index.

@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] :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 [Boolean] :verbose Includes detailed memory usage by Lucene. @option arguments [Hash] :headers Custom HTTP headers

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

# File lib/elasticsearch/api/actions/indices/segments.rb, line 33
def segments(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Provides store information for shard copies of indices.

@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 [List] :status A comma-separated list of statuses used to filter on shards to get store information for (options: green, yellow, red, all) @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/indices-shards-stores.html

# File lib/elasticsearch/api/actions/indices/shard_stores.rb, line 33
def shard_stores(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Allow to shrink an existing index into a new index with fewer primary shards.

@option arguments [String] :index The name of the source index to shrink @option arguments [String] :target The name of the target index to shrink into @option arguments [Boolean] :copy_settings whether or not to copy settings from the source index (defaults to false) @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the shrunken index before the operation returns. @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-shrink-index.html

# File lib/elasticsearch/api/actions/indices/shrink.rb, line 35
def shrink(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
  raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _target = arguments.delete(:target)

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

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

Simulate matching the given index name against the index templates in the system

@option arguments [String] :name The name of the index (it must be a concrete index name) @option arguments [Boolean] :create Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one @option arguments [String] :cause User defined reason for dry-run creating the new template for simulation purposes @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body New index template definition, which will be included in the simulation, as if it already exists in the system

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

# File lib/elasticsearch/api/actions/indices/simulate_index_template.rb, line 33
def simulate_index_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_POST
  path   = "_index_template/_simulate_index/#{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
simulate_template(arguments = {}) click to toggle source

Simulate resolving the given template name or body

@option arguments [String] :name The name of the index template @option arguments [Boolean] :create Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one @option arguments [String] :cause User defined reason for dry-run creating the new template for simulation purposes @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body New index template definition to be simulated, if no index template name is specified

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

# File lib/elasticsearch/api/actions/indices/simulate_template.rb, line 33
def simulate_template(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _name = arguments.delete(:name)

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

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

Allows you to split an existing index into a new index with more primary shards.

@option arguments [String] :index The name of the source index to split @option arguments [String] :target The name of the target index to split into @option arguments [Boolean] :copy_settings whether or not to copy settings from the source index (defaults to false) @option arguments [Time] :timeout Explicit operation timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the shrunken index before the operation returns. @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`)

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-split-index.html

# File lib/elasticsearch/api/actions/indices/split.rb, line 35
def split(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
  raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _target = arguments.delete(:target)

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

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

Provides statistics on operations happening in an index.

@option arguments [List] :metric Limit the information returned the specific metrics. (options: _all, completion, docs, fielddata, query_cache, flush, get, indexing, merge, request_cache, refresh, search, segments, store, warmer, suggest) @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 [List] :completion_fields A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) @option arguments [List] :fielddata_fields A comma-separated list of fields for `fielddata` index metric (supports wildcards) @option arguments [List] :fields A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) @option arguments [List] :groups A comma-separated list of search groups for `search` index metric @option arguments [String] :level Return stats aggregated at cluster, index or shard level (options: cluster, indices, shards) @option arguments [List] :types A comma-separated list of document types for the `indexing` index metric @option arguments [Boolean] :include_segment_file_sizes Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) @option arguments [Boolean] :include_unloaded_segments If set to true segment stats will include stats for segments that are not currently loaded into memory @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 [Boolean] :forbid_closed_indices If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices @option arguments [Hash] :headers Custom HTTP headers

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

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

  method = HTTP_GET
  parts  = Utils.__extract_parts arguments, ParamsRegistry.get(:stats_parts)
  path   = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts)
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(:stats_params)
  params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields]
  params[:groups] = Utils.__listify(params[:groups], :escape => false) if params[:groups]

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

Updates index aliases.

@option arguments [Time] :timeout Request timeout @option arguments [Time] :master_timeout Specify timeout for connection to master @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The definition of `actions` to perform (Required)

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

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

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

  arguments = arguments.clone

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

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

DEPRECATED Upgrades to the current version of Lucene.

@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] :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 [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed) @option arguments [Boolean] :wait_for_completion Specify whether the request should block until the all segments are upgraded (default: false) @option arguments [Boolean] :only_ancient_segments If true, only ancient (an older Lucene major release) segments will be upgraded @option arguments [Hash] :headers Custom HTTP headers

*Deprecation notice*: The _upgrade API is no longer useful and will be removed. Instead, see _reindex API. Deprecated since version 8.0.0

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

# File lib/elasticsearch/api/actions/indices/upgrade.rb, line 39
def upgrade(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

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

Allows a user to validate a potentially expensive query without executing it.

@option arguments [List] :index A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices @option arguments [List] :type A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types Deprecated @option arguments [Boolean] :explain Return detailed information about the error @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 [String] :q Query in the Lucene query string syntax @option arguments [String] :analyzer The analyzer to use for the query string @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be analyzed (default: false) @option arguments [String] :default_operator The default operator for query string query (AND or OR) (options: AND, OR) @option arguments [String] :df The field to use as default where no field prefix is given in the query string @option arguments [Boolean] :lenient Specify whether format-based query failures (such as providing text to a numeric field) should be ignored @option arguments [Boolean] :rewrite Provide a more detailed explanation showing the actual Lucene query that will be executed. @option arguments [Boolean] :all_shards Execute validation on all shards instead of one random shard per index @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The query definition specified with the Query DSL

*Deprecation notice*: Specifying types in urls has been deprecated Deprecated since version 7.0.0

@see www.elastic.co/guide/en/elasticsearch/reference/7.15/search-validate.html

# File lib/elasticsearch/api/actions/indices/validate_query.rb, line 48
def validate_query(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _type = arguments.delete(:type)

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

  path   = if _index && _type
             "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_validate/query"
           elsif _index
             "#{Utils.__listify(_index)}/_validate/query"
           else
             "_validate/query"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end