Module: Elasticsearch::API::DanglingIndices::Actions

Defined in:
lib/elasticsearch/api/actions/dangling_indices/delete_dangling_index.rb,
lib/elasticsearch/api/actions/dangling_indices/import_dangling_index.rb,
lib/elasticsearch/api/actions/dangling_indices/list_dangling_indices.rb

Instance Method Summary collapse

Instance Method Details

#delete_dangling_index(arguments = {}) ⇒ Object

Delete a dangling index. If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. For example, this can happen if you delete more than ‘cluster.indices.tombstones.size` indices while an Elasticsearch node is offline.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index_uuid (String)

    The UUID of the index to delete. Use the get dangling indices API to find the UUID. (Required)

  • :accept_data_loss (Boolean)

    This parameter must be set to true to acknowledge that it will no longer be possible to recove data from the dangling index. (Required)

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :timeout (Time)

    Explicit operation timeout

  • :error_trace (Boolean)

    When set to ‘true` Elasticsearch will include the full stack trace of errors when they occur.

  • :filter_path (String, Array<String>)

    Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch.

  • :human (Boolean)

    When set to ‘true` will return statistics in a format suitable for humans. For example `“exists_time”: “1h”` for humans and `“exists_time_in_millis”: 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines.

  • :pretty (Boolean)

    If set to ‘true` the returned JSON will be “pretty-formatted”. Only use this option for debugging only.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/elasticsearch/api/actions/dangling_indices/delete_dangling_index.rb', line 48

def delete_dangling_index(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'dangling_indices.delete_dangling_index' }

  defined_params = [:index_uuid].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'index_uuid' missing" unless arguments[:index_uuid]

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

  body = nil

  _index_uuid = arguments.delete(:index_uuid)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_dangling/#{Utils.listify(_index_uuid)}"
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end

#import_dangling_index(arguments = {}) ⇒ Object

Import a dangling index. If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. For example, this can happen if you delete more than ‘cluster.indices.tombstones.size` indices while an Elasticsearch node is offline.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index_uuid (String)

    The UUID of the index to import. Use the get dangling indices API to locate the UUID. (Required)

  • :accept_data_loss (Boolean)

    This parameter must be set to true to import a dangling index. Because Elasticsearch cannot know where the dangling index data came from or determine which shard copies are fresh and which are stale, it cannot guarantee that the imported data represents the latest state of the index when it was last in the cluster. (Required)

  • :master_timeout (Time)

    Specify timeout for connection to master

  • :timeout (Time)

    Explicit operation timeout

  • :error_trace (Boolean)

    When set to ‘true` Elasticsearch will include the full stack trace of errors when they occur.

  • :filter_path (String, Array<String>)

    Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch.

  • :human (Boolean)

    When set to ‘true` will return statistics in a format suitable for humans. For example `“exists_time”: “1h”` for humans and `“exists_time_in_millis”: 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines.

  • :pretty (Boolean)

    If set to ‘true` the returned JSON will be “pretty-formatted”. Only use this option for debugging only.

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/elasticsearch/api/actions/dangling_indices/import_dangling_index.rb', line 49

def import_dangling_index(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'dangling_indices.import_dangling_index' }

  defined_params = [:index_uuid].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  raise ArgumentError, "Required argument 'index_uuid' missing" unless arguments[:index_uuid]

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

  body = nil

  _index_uuid = arguments.delete(:index_uuid)

  method = Elasticsearch::API::HTTP_POST
  path   = "_dangling/#{Utils.listify(_index_uuid)}"
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end

#list_dangling_indices(arguments = {}) ⇒ Object

Get the dangling indices. If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. For example, this can happen if you delete more than ‘cluster.indices.tombstones.size` indices while an Elasticsearch node is offline. Use this API to list dangling indices, which you can then import or delete.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :error_trace (Boolean)

    When set to ‘true` Elasticsearch will include the full stack trace of errors when they occur.

  • :filter_path (String, Array<String>)

    Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch.

  • :human (Boolean)

    When set to ‘true` will return statistics in a format suitable for humans. For example `“exists_time”: “1h”` for humans and `“exists_time_in_millis”: 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines.

  • :pretty (Boolean)

    If set to ‘true` the returned JSON will be “pretty-formatted”. Only use this option for debugging only.

  • :headers (Hash)

    Custom HTTP headers

See Also:



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

def list_dangling_indices(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'dangling_indices.list_dangling_indices' }

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

  body = nil

  method = Elasticsearch::API::HTTP_GET
  path   = '_dangling'
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end