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

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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

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

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



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

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):

  • :headers (Hash)

    Custom HTTP headers

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/elasticsearch/api/actions/dangling_indices/list_dangling_indices.rb', line 34

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 = {}

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