module Elasticsearch::API::Snapshot::Actions
Public Instance Methods
Removes stale data from repository.
@option arguments [String] :repository A repository name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/clean-up-snapshot-repo-api.html
# File lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb, line 34 def cleanup_repository(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.cleanup_repository' } defined_params = [:repository].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 'repository' missing" unless arguments[:repository] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _repository = arguments.delete(:repository) method = Elasticsearch::API::HTTP_POST path = "_snapshot/#{Utils.__listify(_repository)}/_cleanup" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Clones indices from one snapshot into another snapshot in the same repository.
@option arguments [String] :repository A repository name @option arguments [String] :snapshot The name of the snapshot to clone from @option arguments [String] :target_snapshot The name of the cloned snapshot to create @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The snapshot clone definition (Required)
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/clone.rb, line 36 def clone(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.clone' } defined_params = %i[repository snapshot target_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] raise ArgumentError, "Required argument 'target_snapshot' missing" unless arguments[:target_snapshot] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _repository = arguments.delete(:repository) _snapshot = arguments.delete(:snapshot) _target_snapshot = arguments.delete(:target_snapshot) method = Elasticsearch::API::HTTP_PUT path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}/_clone/#{Utils.__listify(_target_snapshot)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Creates a snapshot in a repository.
@option arguments [String] :repository A repository name @option arguments [String] :snapshot A snapshot name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The snapshot definition
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/create.rb, line 36 def create(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.create' } defined_params = %i[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 '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_PUT path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Creates a repository.
@option arguments [String] :repository A repository name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Boolean] :verify Whether to verify the repository after creation @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The repository definition (Required)
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/create_repository.rb, line 36 def create_repository(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.create_repository' } defined_params = [:repository].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] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _repository = arguments.delete(:repository) method = Elasticsearch::API::HTTP_PUT path = "_snapshot/#{Utils.__listify(_repository)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Deletes one or more snapshots.
@option arguments [String] :repository A repository name @option arguments [List] :snapshot A comma-separated list of snapshot names @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/delete.rb, line 35 def delete(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.delete' } defined_params = %i[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 'repository' missing" unless arguments[:repository] raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _repository = arguments.delete(:repository) _snapshot = arguments.delete(:snapshot) method = Elasticsearch::API::HTTP_DELETE path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}" params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end
Deletes a repository.
@option arguments [List] :repository Name of the snapshot repository to unregister. Wildcard (‘*`) patterns are supported. @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/delete_repository.rb, line 34 def delete_repository(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.delete_repository' } defined_params = [:repository].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 'repository' missing" unless arguments[:repository] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _repository = arguments.delete(:repository) method = Elasticsearch::API::HTTP_DELETE path = "_snapshot/#{Utils.__listify(_repository)}" params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end
Returns information about a snapshot.
@option arguments [String] :repository A repository name @option arguments [List] :snapshot A comma-separated list of snapshot names @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown @option arguments [Boolean] :index_names Whether to include the name of each index in the snapshot. Defaults to true. @option arguments [Boolean] :index_details Whether to include details of each index in the snapshot, if those details are available. Defaults to false. @option arguments [Boolean] :include_repository Whether to include the repository name in the snapshot info. Defaults to true. @option arguments [String] :sort Allows setting a sort order for the result. Defaults to start_time (options: start_time, duration, name, repository, index_count, shard_count, failed_shard_count) @option arguments [Integer] :size Maximum number of snapshots to return. Defaults to 0 which means return all that match without limit. @option arguments [String] :order Sort order (options: asc, desc) @option arguments [String] :from_sort_value Value of the current sort column at which to start retrieval. @option arguments [String] :after Offset identifier to start pagination from as returned by the ‘next’ field in the response body. @option arguments [Integer] :offset Numeric offset to start pagination based on the snapshots matching the request. Defaults to 0 @option arguments [String] :slm_policy_filter Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Accepts wildcards. Use the special pattern ‘_none’ to match snapshots without an SLM policy @option arguments [Boolean] :verbose Whether to show verbose snapshot info or only show the basic info found in the repository index blob @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/get.rb, line 46 def get(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.get' } defined_params = %i[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 'repository' missing" unless arguments[:repository] raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _repository = arguments.delete(:repository) _snapshot = arguments.delete(:snapshot) method = Elasticsearch::API::HTTP_GET path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}" params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end
Returns information about a repository.
@option arguments [List] :repository A comma-separated list of repository names @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false) @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/get_repository.rb, line 34 def get_repository(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.get_repository' } defined_params = [:repository].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 _repository = arguments.delete(:repository) method = Elasticsearch::API::HTTP_GET path = if _repository "_snapshot/#{Utils.__listify(_repository)}" else '_snapshot' end params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end
Analyzes a repository for correctness and performance
@option arguments [String] :repository A repository name @option arguments [Number] :blob_count Number of blobs to create during the test. Defaults to 100. @option arguments [Number] :concurrency Number of operations to run concurrently during the test. Defaults to 10. @option arguments [Number] :read_node_count Number of nodes on which to read a blob after writing. Defaults to 10. @option arguments [Number] :early_read_node_count Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the ‘rare_action_probability’ parameter is also relevant. Defaults to 2. @option arguments [Number] :seed Seed for the random number generator used to create the test workload. Defaults to a random value. @option arguments [Number] :rare_action_probability Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. @option arguments [String] :max_blob_size Maximum size of a blob to create during the test, e.g ‘1gb’ or ‘100mb’. Defaults to ‘10mb’. @option arguments [String] :max_total_data_size Maximum total size of all blobs to create during the test, e.g ‘1tb’ or ‘100gb’. Defaults to ‘1gb’. @option arguments [Time] :timeout Explicit operation timeout. Defaults to ‘30s’. @option arguments [Boolean] :detailed Whether to return detailed results or a summary. Defaults to ‘false’ so that only the summary is returned. @option arguments [Boolean] :rarely_abort_writes Whether to rarely abort writes before they complete. Defaults to ‘true’. @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/repository_analyze.rb, line 43 def repository_analyze(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.repository_analyze' } defined_params = [:repository].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 'repository' missing" unless arguments[:repository] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _repository = arguments.delete(:repository) method = Elasticsearch::API::HTTP_POST path = "_snapshot/#{Utils.__listify(_repository)}/_analyze" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Restores a snapshot.
@option arguments [String] :repository A repository name @option arguments [String] :snapshot A snapshot name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Details of what to restore
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/restore.rb, line 36 def restore(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.restore' } defined_params = %i[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 '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)}/_restore" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Returns information about the status of a snapshot.
@option arguments [String] :repository A repository name @option arguments [List] :snapshot A comma-separated list of snapshot names @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/status.rb, line 35 def status(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.status' } defined_params = %i[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? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _repository = arguments.delete(:repository) _snapshot = arguments.delete(:snapshot) method = Elasticsearch::API::HTTP_GET path = if _repository && _snapshot "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}/_status" elsif _repository "_snapshot/#{Utils.__listify(_repository)}/_status" else '_snapshot/_status' end params = Utils.process_params(arguments) if Array(arguments[:ignore]).include?(404) Utils.__rescue_from_not_found do Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end else Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end end
Verifies a repository.
@option arguments [String] :repository A repository name @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node @option arguments [Time] :timeout Explicit operation timeout @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/8.16/modules-snapshots.html
# File lib/elasticsearch/api/actions/snapshot/verify_repository.rb, line 34 def verify_repository(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'snapshot.verify_repository' } defined_params = [:repository].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 'repository' missing" unless arguments[:repository] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _repository = arguments.delete(:repository) method = Elasticsearch::API::HTTP_POST path = "_snapshot/#{Utils.__listify(_repository)}/_verify" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end