Module: Elasticsearch::API::SearchableSnapshots::Actions

Defined in:
lib/elasticsearch/api/actions/searchable_snapshots/mount.rb,
lib/elasticsearch/api/actions/searchable_snapshots/stats.rb,
lib/elasticsearch/api/actions/searchable_snapshots/cache_stats.rb,
lib/elasticsearch/api/actions/searchable_snapshots/clear_cache.rb

Instance Method Summary collapse

Instance Method Details

#cache_stats(arguments = {}) ⇒ Object

Get cache statistics. Get statistics about the shared cache for partially mounted indices. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :node_id (String, Array)

    The names of the nodes in the cluster to target.

  • :master_timeout (Time)
    TODO
  • :headers (Hash)

    Custom HTTP headers

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
63
64
# File 'lib/elasticsearch/api/actions/searchable_snapshots/cache_stats.rb', line 38

def cache_stats(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'searchable_snapshots.cache_stats' }

  defined_params = [:node_id].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?

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

  body = nil

  _node_id = arguments.delete(:node_id)

  method = Elasticsearch::API::HTTP_GET
  path   = if _node_id
             "_searchable_snapshots/#{Utils.listify(_node_id)}/cache/stats"
           else
             '_searchable_snapshots/cache/stats'
           end
  params = Utils.process_params(arguments)

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

#clear_cache(arguments = {}) ⇒ Object

Clear the cache. Clear indices and data streams from the shared cache for partially mounted indices. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    A comma-separated list of data streams, indices, and aliases to clear from the cache. It supports wildcards (+*+).

  • :expand_wildcards (String, Array<String>)

    Whether to expand wildcard expression to concrete indices that are open, closed or both.

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

  • :ignore_unavailable (Boolean)

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

  • :headers (Hash)

    Custom HTTP headers

See Also:



41
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
67
# File 'lib/elasticsearch/api/actions/searchable_snapshots/clear_cache.rb', line 41

def clear_cache(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'searchable_snapshots.clear_cache' }

  defined_params = [:index].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?

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

  body = nil

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = if _index
             "#{Utils.listify(_index)}/_searchable_snapshots/cache/clear"
           else
             '_searchable_snapshots/cache/clear'
           end
  params = Utils.process_params(arguments)

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

#mount(arguments = {}) ⇒ Object

Mount a snapshot. Mount a snapshot as a searchable snapshot index. Do not use this API for snapshots managed by index lifecycle management (ILM). Manually mounting ILM-managed snapshots can interfere with ILM processes.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :repository (String)

    The name of the repository containing the snapshot of the index to mount. (Required)

  • :snapshot (String)

    The name of the snapshot of the index to mount. (Required)

  • :master_timeout (Time)

    The period to wait for the master node. If the master node is not available before the timeout expires, the request fails and returns an error. To indicate that the request should never timeout, set it to -1. Server default: 30s.

  • :wait_for_completion (Boolean)

    If true, the request blocks until the operation is complete.

  • :storage (String)

    The mount option for the searchable snapshot index. Server default: full_copy.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    request body

Raises:

  • (ArgumentError)

See Also:



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
67
68
69
70
# File 'lib/elasticsearch/api/actions/searchable_snapshots/mount.rb', line 42

def mount(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'searchable_snapshots.mount' }

  defined_params = [:repository, :snapshot].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 'body' missing" unless arguments[:body]
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
  raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]

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

  body = arguments.delete(:body)

  _repository = arguments.delete(:repository)

  _snapshot = arguments.delete(:snapshot)

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

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

#stats(arguments = {}) ⇒ Object

Get searchable snapshot statistics.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String, Array)

    A comma-separated list of data streams and indices to retrieve statistics for.

  • :level (String)

    Return stats aggregated at cluster, index or shard level

  • :headers (Hash)

    Custom HTTP headers

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/elasticsearch/api/actions/searchable_snapshots/stats.rb', line 33

def stats(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'searchable_snapshots.stats' }

  defined_params = [:index].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?

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

  body = nil

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = if _index
             "#{Utils.listify(_index)}/_searchable_snapshots/stats"
           else
             '_searchable_snapshots/stats'
           end
  params = Utils.process_params(arguments)

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