Module: OpenSearch::API::Indices::Actions

Included in:
IndicesClient
Defined in:
lib/opensearch/api/namespace/indices.rb,
lib/opensearch/api/actions/indices/get.rb,
lib/opensearch/api/actions/indices/open.rb,
lib/opensearch/api/actions/indices/clone.rb,
lib/opensearch/api/actions/indices/close.rb,
lib/opensearch/api/actions/indices/flush.rb,
lib/opensearch/api/actions/indices/split.rb,
lib/opensearch/api/actions/indices/stats.rb,
lib/opensearch/api/actions/indices/create.rb,
lib/opensearch/api/actions/indices/delete.rb,
lib/opensearch/api/actions/indices/exists.rb,
lib/opensearch/api/actions/indices/shrink.rb,
lib/opensearch/api/actions/indices/analyze.rb,
lib/opensearch/api/actions/indices/refresh.rb,
lib/opensearch/api/actions/indices/upgrade.rb,
lib/opensearch/api/actions/indices/recovery.rb,
lib/opensearch/api/actions/indices/rollover.rb,
lib/opensearch/api/actions/indices/segments.rb,
lib/opensearch/api/actions/indices/add_block.rb,
lib/opensearch/api/actions/indices/get_alias.rb,
lib/opensearch/api/actions/indices/put_alias.rb,
lib/opensearch/api/actions/indices/disk_usage.rb,
lib/opensearch/api/actions/indices/forcemerge.rb,
lib/opensearch/api/actions/indices/clear_cache.rb,
lib/opensearch/api/actions/indices/get_mapping.rb,
lib/opensearch/api/actions/indices/get_upgrade.rb,
lib/opensearch/api/actions/indices/put_mapping.rb,
lib/opensearch/api/actions/indices/delete_alias.rb,
lib/opensearch/api/actions/indices/exists_alias.rb,
lib/opensearch/api/actions/indices/get_settings.rb,
lib/opensearch/api/actions/indices/get_template.rb,
lib/opensearch/api/actions/indices/put_settings.rb,
lib/opensearch/api/actions/indices/put_template.rb,
lib/opensearch/api/actions/indices/shard_stores.rb,
lib/opensearch/api/actions/indices/resolve_index.rb,
lib/opensearch/api/actions/indices/update_aliases.rb,
lib/opensearch/api/actions/indices/validate_query.rb,
lib/opensearch/api/actions/indices/delete_template.rb,
lib/opensearch/api/actions/indices/exists_template.rb,
lib/opensearch/api/actions/indices/params_registry.rb,
lib/opensearch/api/actions/indices/field_usage_stats.rb,
lib/opensearch/api/actions/indices/get_field_mapping.rb,
lib/opensearch/api/actions/indices/simulate_template.rb,
lib/opensearch/api/actions/indices/get_index_template.rb,
lib/opensearch/api/actions/indices/put_index_template.rb,
lib/opensearch/api/actions/indices/delete_index_template.rb,
lib/opensearch/api/actions/indices/exists_index_template.rb,
lib/opensearch/api/actions/indices/simulate_index_template.rb

Defined Under Namespace

Modules: ParamsRegistry

Instance Method Summary collapse

Instance Method Details

#add_block(arguments = {}) ⇒ Object

Adds a block to an index.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma separated list of indices to add a block to

  • :block (String)

    The block to add (one of read, write, read_only or metadata)

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/opensearch/api/actions/indices/add_block.rb', line 44

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 = OpenSearch::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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index to scope the operation

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    Define analyzer/tokenizer parameters and the text on which the analysis should be performed



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/opensearch/api/actions/indices/analyze.rb', line 38

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = if arguments[:body]
             OpenSearch::API::HTTP_POST
           else
             OpenSearch::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 = {}) ⇒ Object

Clears all or specific caches for one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index name to limit the operation

  • :fielddata (Boolean)

    Clear field data

  • :fields (List)

    A comma-separated list of fields to clear when using the ‘fielddata` parameter (default: all)

  • :query (Boolean)

    Clear query caches

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :request (Boolean)

    Clear request cache

  • :headers (Hash)

    Custom HTTP headers



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/opensearch/api/actions/indices/clear_cache.rb', line 44

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Clones an index

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the source index to clone

  • :target (String)

    The name of the target index to clone into

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :wait_for_active_shards (String)

    Set the number of active shards to wait for on the cloned index before the operation returns.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The configuration for the target index (‘settings` and `aliases`)

Raises:

  • (ArgumentError)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/opensearch/api/actions/indices/clone.rb', line 43

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 = OpenSearch::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 = {}) ⇒ Object

Closes an index.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma separated list of indices to close

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :wait_for_active_shards (String)

    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`.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/opensearch/api/actions/indices/close.rb', line 44

def close(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Creates an index with optional settings and mappings.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index

  • :wait_for_active_shards (String)

    Set the number of active shards to wait for before the operation returns.

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The configuration for the index (‘settings` and `mappings`)

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/opensearch/api/actions/indices/create.rb', line 42

def create(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Deletes an index.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of indices to delete; use ‘_all` or `*` string to delete all indices

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :ignore_unavailable (Boolean)

    Ignore unavailable indexes (default: false)

  • :allow_no_indices (Boolean)

    Ignore if a wildcard expression resolves to no concrete indices (default: false)

  • :expand_wildcards (String)

    Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/opensearch/api/actions/indices/delete.rb', line 43

def delete(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Deletes an alias.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names (supports wildcards); use ‘_all` for all indices

  • :name (List)

    A comma-separated list of aliases to delete (supports wildcards); use ‘_all` to delete all aliases for the specified indices.

  • :timeout (Time)

    Explicit timestamp for the document

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/opensearch/api/actions/indices/delete_alias.rb', line 41

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 = OpenSearch::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 = {}) ⇒ Object

Deletes an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the template

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/opensearch/api/actions/indices/delete_index_template.rb', line 40

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 = OpenSearch::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 = {}) ⇒ Object

Deletes an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the template

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/opensearch/api/actions/indices/delete_template.rb', line 40

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 = OpenSearch::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 = {}) ⇒ Object

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. OpenSearch will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    Comma-separated list of indices or data streams to analyze the disk usage

  • :run_expensive_tasks (Boolean)

    Must be set to [true] in order for the task to be performed. Defaults to false.

  • :flush (Boolean)

    Whether flush or not before analyzing the index disk usage. Defaults to true

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/opensearch/api/actions/indices/disk_usage.rb', line 46

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 = OpenSearch::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 = {}) ⇒ Object Also known as: exists?

Returns information about whether a particular index exists.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names

  • :local (Boolean)

    Return local information, do not retrieve the state from master node (default: false)

  • :ignore_unavailable (Boolean)

    Ignore unavailable indexes (default: false)

  • :allow_no_indices (Boolean)

    Ignore if a wildcard expression resolves to no concrete indices (default: false)

  • :expand_wildcards (String)

    Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :include_defaults (Boolean)

    Whether to return all default setting for each of the indices.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/opensearch/api/actions/indices/exists.rb', line 43

def exists(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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

#exists_alias(arguments = {}) ⇒ Object Also known as: exists_alias?

Returns information about whether a particular alias exists.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    A comma-separated list of alias names to return

  • :index (List)

    A comma-separated list of index names to filter aliases

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :local (Boolean)

    Return local information, do not retrieve the state from master node (default: false)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/opensearch/api/actions/indices/exists_alias.rb', line 42

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 = OpenSearch::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

#exists_index_template(arguments = {}) ⇒ Object Also known as: exists_index_template?

Returns information about whether a particular index template exists.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the template

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Explicit operation timeout for connection to master node

  • :cluster_manager_timeout (Time)

    Explicit operation timeout for connection to cluster_manager node

  • :local (Boolean)

    Return local information, do not retrieve the state from cluster_manager node (default: false)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/opensearch/api/actions/indices/exists_index_template.rb', line 41

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 = OpenSearch::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

#exists_template(arguments = {}) ⇒ Object Also known as: exists_template?

Returns information about whether a particular index template exists.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    The comma separated names of the index templates

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Explicit operation timeout for connection to master node

  • :cluster_manager_timeout (Time)

    Explicit operation timeout for connection to cluster_manager node

  • :local (Boolean)

    Return local information, do not retrieve the state from cluster_manager node (default: false)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/opensearch/api/actions/indices/exists_template.rb', line 41

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 = OpenSearch::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

#field_usage_stats(arguments = {}) ⇒ Object

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. OpenSearch will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :fields (List)

    A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards)

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/opensearch/api/actions/indices/field_usage_stats.rb', line 45

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 = OpenSearch::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 = {}) ⇒ Object

Performs the flush operation on one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string for all indices

  • :force (Boolean)

    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)

  • :wait_if_ongoing (Boolean)

    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.

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/opensearch/api/actions/indices/flush.rb', line 42

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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

#forcemerge(arguments = {}) ⇒ Object

Performs the force merge operation on one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :flush (Boolean)

    Specify whether the index should be flushed after performing the operation (default: true)

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :max_num_segments (Number)

    The number of segments the index should be merged into (default: dynamic)

  • :only_expunge_deletes (Boolean)

    Specify whether the operation should only expunge deleted documents

  • :headers (Hash)

    Custom HTTP headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/opensearch/api/actions/indices/forcemerge.rb', line 43

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Returns information about one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names

  • :local (Boolean)

    Return local information, do not retrieve the state from master node (default: false)

  • :ignore_unavailable (Boolean)

    Ignore unavailable indexes (default: false)

  • :allow_no_indices (Boolean)

    Ignore if a wildcard expression resolves to no concrete indices (default: false)

  • :expand_wildcards (String)

    Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :include_defaults (Boolean)

    Whether to return all default setting for each of the indices.

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/opensearch/api/actions/indices/get.rb', line 45

def get(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Returns an alias.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    A comma-separated list of alias names to return

  • :index (List)

    A comma-separated list of index names to filter aliases

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :local (Boolean)

    Return local information, do not retrieve the state from master node (default: false)

  • :headers (Hash)

    Custom HTTP headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/opensearch/api/actions/indices/get_alias.rb', line 42

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Returns mapping for one or more fields.

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :fields (List)

    A comma-separated list of fields

  • :index (List)

    A comma-separated list of index names

  • :include_defaults (Boolean)

    Whether the default mapping values should be returned as well

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :local (Boolean)

    Return local information, do not retrieve the state from master node (default: false)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/opensearch/api/actions/indices/get_field_mapping.rb', line 48

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)

  method = OpenSearch::API::HTTP_GET
  path   = if _index && _fields
             "#{Utils.__listify(_index)}/_mapping/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 = {}) ⇒ Object

Returns an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    The comma separated names of the index templates

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Explicit operation timeout for connection to master node

  • :cluster_manager_timeout (Time)

    Explicit operation timeout for connection to cluster_manager node

  • :local (Boolean)

    Return local information, do not retrieve the state from cluster_manager node (default: false)

  • :headers (Hash)

    Custom HTTP headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/opensearch/api/actions/indices/get_index_template.rb', line 41

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = OpenSearch::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 = {}) ⇒ Object

Returns mappings for one or more indices.

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :local (Boolean)

    Return local information, do not retrieve the state from cluster_manager node (default: false) Deprecated

  • :headers (Hash)

    Custom HTTP headers



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/opensearch/api/actions/indices/get_mapping.rb', line 48

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::API::HTTP_GET
  path   = if _index
             "#{Utils.__listify(_index)}/_mapping"
           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 = {}) ⇒ Object

Returns settings for one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :name (List)

    The name of the settings that should be included

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :local (Boolean)

    Return local information, do not retrieve the state from master node (default: false)

  • :include_defaults (Boolean)

    Whether to return all default setting for each of the indices.

  • :headers (Hash)

    Custom HTTP headers



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/opensearch/api/actions/indices/get_settings.rb', line 46

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  _name = arguments.delete(:name)

  method = OpenSearch::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 = {}) ⇒ Object

Returns an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    The comma separated names of the index templates

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Explicit operation timeout for connection to master node

  • :cluster_manager_timeout (Time)

    Explicit operation timeout for connection to cluster_manager node

  • :local (Boolean)

    Return local information, do not retrieve the state from cluster_manager node (default: false)

  • :headers (Hash)

    Custom HTTP headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/opensearch/api/actions/indices/get_template.rb', line 41

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = OpenSearch::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 = {}) ⇒ Object

DEPRECATED Returns a progress status of current upgrade.

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/opensearch/api/actions/indices/get_upgrade.rb', line 45

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Opens an index.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma separated list of indices to open

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Explicit operation timeout for connection to cluster_manager node

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :wait_for_active_shards (String)

    Sets the number of active shards to wait for before the operation returns.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/opensearch/api/actions/indices/open.rb', line 44

def open(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Creates or updates an alias.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names the alias should point to (supports wildcards); use ‘_all` to perform the operation on all indices.

  • :name (String)

    The name of the alias to be created or updated

  • :timeout (Time)

    Explicit timestamp for the document

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The settings for the alias, such as ‘routing` or `filter`

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/opensearch/api/actions/indices/put_alias.rb', line 42

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 = OpenSearch::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 = {}) ⇒ Object

Creates or updates an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the template

  • :create (Boolean)

    Whether the index template should only be added if new or can also replace an existing one

  • :cause (String)

    User defined reason for creating/updating the index template

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The template definition (Required)

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/opensearch/api/actions/indices/put_index_template.rb', line 42

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 = OpenSearch::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 = {}) ⇒ Object

Updates the index mappings.

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    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.

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :write_index_only (Boolean)

    When true, applies mappings only to the write index of an alias or data stream

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The mapping definition (Required)

Raises:

  • (ArgumentError)


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/opensearch/api/actions/indices/put_mapping.rb', line 50

def put_mapping(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::API::HTTP_PUT
  path   = "#{Utils.__listify(_index)}/_mappings"
  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 = {}) ⇒ Object

Updates the index settings.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :timeout (Time)

    Explicit operation timeout

  • :preserve_existing (Boolean)

    Whether to update existing settings. If set to ‘true` existing settings on an index remain unchanged, the default is `false`

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :flat_settings (Boolean)

    Return settings in flat format (default: false)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The index settings to be updated (Required)

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/opensearch/api/actions/indices/put_settings.rb', line 46

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 = OpenSearch::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 = {}) ⇒ Object

Creates or updates an index template.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the template

  • :order (Number)

    The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)

  • :create (Boolean)

    Whether the index template should only be added if new or can also replace an existing one

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The template definition (Required)

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/opensearch/api/actions/indices/put_template.rb', line 42

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 = OpenSearch::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 = {}) ⇒ Object

Returns information about ongoing index shard recoveries.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :detailed (Boolean)

    Whether to display detailed information about shard recovery

  • :active_only (Boolean)

    Display only those recoveries that are currently on-going

  • :headers (Hash)

    Custom HTTP headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/opensearch/api/actions/indices/recovery.rb', line 39

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Performs the refresh operation in one or more indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/opensearch/api/actions/indices/refresh.rb', line 40

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

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. OpenSearch will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (List)

    A comma-separated list of names or wildcard expressions

  • :expand_wildcards (String)

    Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/opensearch/api/actions/indices/resolve_index.rb', line 42

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 = OpenSearch::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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :alias (String)

    The name of the alias to rollover

  • :new_index (String)

    The name of the rollover index

  • :timeout (Time)

    Explicit operation timeout

  • :dry_run (Boolean)

    If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :wait_for_active_shards (String)

    Set the number of active shards to wait for on the newly created rollover index before the operation returns.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The conditions that needs to be met for executing rollover

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/opensearch/api/actions/indices/rollover.rb', line 45

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 = OpenSearch::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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :verbose (Boolean)

    Includes detailed memory usage by Lucene.

  • :headers (Hash)

    Custom HTTP headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/opensearch/api/actions/indices/segments.rb', line 41

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

Provides store information for shard copies of indices.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :status (List)

    A comma-separated list of statuses used to filter on shards to get store information for (options: green, yellow, red, all)

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :headers (Hash)

    Custom HTTP headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/opensearch/api/actions/indices/shard_stores.rb', line 41

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the source index to shrink

  • :target (String)

    The name of the target index to shrink into

  • :copy_settings (Boolean)

    whether or not to copy settings from the source index (defaults to false)

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :wait_for_active_shards (String)

    Set the number of active shards to wait for on the shrunken index before the operation returns.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The configuration for the target index (‘settings` and `aliases`)

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/opensearch/api/actions/indices/shrink.rb', line 44

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 = OpenSearch::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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the index (it must be a concrete index name)

  • :create (Boolean)

    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

  • :cause (String)

    User defined reason for dry-run creating the new template for simulation purposes

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    New index template definition, which will be included in the simulation, as if it already exists in the system

Raises:

  • (ArgumentError)


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/opensearch/api/actions/indices/simulate_index_template.rb', line 42

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 = OpenSearch::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 = {}) ⇒ Object

Simulate resolving the given template name or body

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the index template

  • :create (Boolean)

    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

  • :cause (String)

    User defined reason for dry-run creating the new template for simulation purposes

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    New index template definition to be simulated, if no index template name is specified



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/opensearch/api/actions/indices/simulate_template.rb', line 42

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

  arguments = arguments.clone

  _name = arguments.delete(:name)

  method = OpenSearch::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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the source index to split

  • :target (String)

    The name of the target index to split into

  • :copy_settings (Boolean)

    whether or not to copy settings from the source index (defaults to false)

  • :timeout (Time)

    Explicit operation timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :wait_for_active_shards (String)

    Set the number of active shards to wait for on the shrunken index before the operation returns.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The configuration for the target index (‘settings` and `aliases`)

Raises:

  • (ArgumentError)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/opensearch/api/actions/indices/split.rb', line 44

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 = OpenSearch::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 = {}) ⇒ Object

Provides statistics on operations happening in an index.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :metric (List)

    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)

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :completion_fields (List)

    A comma-separated list of fields for ‘fielddata` and `suggest` index metric (supports wildcards)

  • :fielddata_fields (List)

    A comma-separated list of fields for ‘fielddata` index metric (supports wildcards)

  • :fields (List)

    A comma-separated list of fields for ‘fielddata` and `completion` index metric (supports wildcards)

  • :groups (List)

    A comma-separated list of search groups for ‘search` index metric

  • :level (String)

    Return stats aggregated at cluster, index or shard level (options: cluster, indices, shards)

  • :types (List)

    A comma-separated list of document types for the ‘indexing` index metric

  • :include_segment_file_sizes (Boolean)

    Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)

  • :include_unloaded_segments (Boolean)

    If set to true segment stats will include stats for segments that are not currently loaded into memory

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :forbid_closed_indices (Boolean)

    If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices

  • :headers (Hash)

    Custom HTTP headers



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/opensearch/api/actions/indices/stats.rb', line 48

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 = {}) ⇒ Object

Updates index aliases.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :timeout (Time)

    Request timeout

  • :master_timeout (Time) — default: DEPRECATED: use cluster_manager_timeout instead

    Specify timeout for connection to master

  • :cluster_manager_timeout (Time)

    Specify timeout for connection to cluster_manager

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The definition of ‘actions` to perform (Required)

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/opensearch/api/actions/indices/update_aliases.rb', line 40

def update_aliases(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

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

  arguments = arguments.clone

  method = OpenSearch::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 = {}) ⇒ Object

DEPRECATED Upgrades to the current version of Lucene.

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names; use ‘_all` or empty string to perform the operation on all indices

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :wait_for_completion (Boolean)

    Specify whether the request should block until the all segments are upgraded (default: false)

  • :only_ancient_segments (Boolean)

    If true, only ancient (an older Lucene major release) segments will be upgraded

  • :headers (Hash)

    Custom HTTP headers



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/opensearch/api/actions/indices/upgrade.rb', line 47

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = OpenSearch::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 = {}) ⇒ Object

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

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (List)

    A comma-separated list of index names to restrict the operation; use ‘_all` or empty string to perform the operation on all indices

  • :explain (Boolean)

    Return detailed information about the error

  • :ignore_unavailable (Boolean)

    Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • :allow_no_indices (Boolean)

    Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes ‘_all` string or when no indices have been specified)

  • :expand_wildcards (String)

    Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)

  • :q (String)

    Query in the Lucene query string syntax

  • :analyzer (String)

    The analyzer to use for the query string

  • :analyze_wildcard (Boolean)

    Specify whether wildcard and prefix queries should be analyzed (default: false)

  • :default_operator (String)

    The default operator for query string query (AND or OR) (options: AND, OR)

  • :df (String)

    The field to use as default where no field prefix is given in the query string

  • :lenient (Boolean)

    Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

  • :rewrite (Boolean)

    Provide a more detailed explanation showing the actual Lucene query that will be executed.

  • :all_shards (Boolean)

    Execute validation on all shards instead of one random shard per index

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The query definition specified with the Query DSL



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/opensearch/api/actions/indices/validate_query.rb', line 55

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

  arguments = arguments.clone

  _index = arguments.delete(:index)

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

  path = if _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