elasticsearch-api 7.3.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +16 -23
- data/elasticsearch-api.gemspec +1 -1
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -2
- data/lib/elasticsearch/api/actions/benchmark.rb +2 -3
- data/lib/elasticsearch/api/actions/bulk.rb +35 -68
- data/lib/elasticsearch/api/actions/cat/aliases.rb +30 -52
- data/lib/elasticsearch/api/actions/cat/allocation.rb +36 -50
- data/lib/elasticsearch/api/actions/cat/count.rb +25 -46
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +31 -33
- data/lib/elasticsearch/api/actions/cat/health.rb +27 -37
- data/lib/elasticsearch/api/actions/cat/help.rb +14 -10
- data/lib/elasticsearch/api/actions/cat/indices.rb +45 -62
- data/lib/elasticsearch/api/actions/cat/master.rb +24 -34
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +20 -16
- data/lib/elasticsearch/api/actions/cat/nodes.rb +34 -46
- data/lib/elasticsearch/api/actions/cat/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +29 -35
- data/lib/elasticsearch/api/actions/cat/plugins.rb +21 -18
- data/lib/elasticsearch/api/actions/cat/recovery.rb +40 -56
- data/lib/elasticsearch/api/actions/cat/repositories.rb +21 -24
- data/lib/elasticsearch/api/actions/cat/segments.rb +29 -22
- data/lib/elasticsearch/api/actions/cat/shards.rb +38 -59
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +32 -27
- data/lib/elasticsearch/api/actions/cat/tasks.rb +25 -19
- data/lib/elasticsearch/api/actions/cat/templates.rb +26 -18
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +36 -46
- data/lib/elasticsearch/api/actions/clear_scroll.rb +21 -8
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +15 -13
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +18 -18
- data/lib/elasticsearch/api/actions/cluster/health.rb +42 -44
- data/lib/elasticsearch/api/actions/cluster/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +15 -17
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +20 -17
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +8 -6
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +25 -37
- data/lib/elasticsearch/api/actions/cluster/state.rb +37 -41
- data/lib/elasticsearch/api/actions/cluster/stats.rb +20 -12
- data/lib/elasticsearch/api/actions/count.rb +52 -39
- data/lib/elasticsearch/api/actions/create.rb +25 -26
- data/lib/elasticsearch/api/actions/delete.rb +43 -36
- data/lib/elasticsearch/api/actions/delete_by_query.rb +74 -62
- data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +39 -0
- data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +4 -3
- data/lib/elasticsearch/api/actions/delete_script.rb +19 -13
- data/lib/elasticsearch/api/actions/exists.rb +44 -34
- data/lib/elasticsearch/api/actions/exists_source.rb +43 -25
- data/lib/elasticsearch/api/actions/explain.rb +46 -51
- data/lib/elasticsearch/api/actions/field_caps.rb +27 -20
- data/lib/elasticsearch/api/actions/get.rb +42 -41
- data/lib/elasticsearch/api/actions/get_script.rb +19 -14
- data/lib/elasticsearch/api/actions/get_source.rb +38 -44
- data/lib/elasticsearch/api/actions/index.rb +60 -89
- data/lib/elasticsearch/api/actions/indices/analyze.rb +19 -48
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +29 -41
- data/lib/elasticsearch/api/actions/indices/clone.rb +50 -0
- data/lib/elasticsearch/api/actions/indices/close.rb +28 -32
- data/lib/elasticsearch/api/actions/indices/create.rb +22 -70
- data/lib/elasticsearch/api/actions/indices/delete.rb +23 -35
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +24 -20
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +18 -20
- data/lib/elasticsearch/api/actions/indices/exists.rb +32 -34
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +33 -29
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +21 -16
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +29 -29
- data/lib/elasticsearch/api/actions/indices/flush.rb +28 -28
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +23 -12
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +26 -41
- data/lib/elasticsearch/api/actions/indices/freeze.rb +7 -8
- data/lib/elasticsearch/api/actions/indices/get.rb +25 -19
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +31 -23
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +42 -38
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +39 -31
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +34 -37
- data/lib/elasticsearch/api/actions/indices/get_template.rb +21 -23
- data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +48 -0
- data/lib/elasticsearch/api/actions/indices/open.rb +24 -21
- data/lib/elasticsearch/api/actions/indices/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +25 -27
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +40 -39
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +30 -37
- data/lib/elasticsearch/api/actions/indices/put_template.rb +23 -23
- data/lib/elasticsearch/api/actions/indices/recovery.rb +20 -23
- data/lib/elasticsearch/api/actions/indices/refresh.rb +22 -26
- data/lib/elasticsearch/api/actions/indices/rollover.rb +28 -19
- data/lib/elasticsearch/api/actions/indices/segments.rb +24 -17
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +27 -15
- data/lib/elasticsearch/api/actions/indices/shrink.rb +23 -17
- data/lib/elasticsearch/api/actions/indices/split.rb +23 -17
- data/lib/elasticsearch/api/actions/indices/stats.rb +53 -104
- data/lib/elasticsearch/api/actions/indices/unfreeze.rb +7 -7
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +15 -32
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +26 -16
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +46 -59
- data/lib/elasticsearch/api/actions/info.rb +9 -6
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +18 -12
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +21 -11
- data/lib/elasticsearch/api/actions/ingest/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +12 -13
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +19 -14
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +23 -13
- data/lib/elasticsearch/api/actions/mget.rb +37 -44
- data/lib/elasticsearch/api/actions/msearch.rb +54 -54
- data/lib/elasticsearch/api/actions/msearch_template.rb +46 -35
- data/lib/elasticsearch/api/actions/mtermvectors.rb +39 -35
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +30 -25
- data/lib/elasticsearch/api/actions/nodes/info.rb +29 -63
- data/lib/elasticsearch/api/actions/nodes/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +24 -22
- data/lib/elasticsearch/api/actions/nodes/shutdown.rb +4 -4
- data/lib/elasticsearch/api/actions/nodes/stats.rb +43 -36
- data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -10
- data/lib/elasticsearch/api/actions/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/ping.rb +12 -13
- data/lib/elasticsearch/api/actions/put_script.rb +26 -30
- data/lib/elasticsearch/api/actions/rank_eval.rb +24 -15
- data/lib/elasticsearch/api/actions/reindex.rb +25 -48
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +18 -12
- data/lib/elasticsearch/api/actions/remote/info.rb +1 -2
- data/lib/elasticsearch/api/actions/render_search_template.rb +17 -15
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +8 -6
- data/lib/elasticsearch/api/actions/scroll.rb +28 -51
- data/lib/elasticsearch/api/actions/search.rb +104 -165
- data/lib/elasticsearch/api/actions/search_shards.rb +31 -28
- data/lib/elasticsearch/api/actions/search_template.rb +48 -40
- data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +44 -0
- data/lib/elasticsearch/api/actions/snapshot/create.rb +22 -29
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +19 -24
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +20 -22
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +16 -18
- data/lib/elasticsearch/api/actions/snapshot/get.rb +22 -31
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +21 -25
- data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +21 -32
- data/lib/elasticsearch/api/actions/snapshot/status.rb +23 -24
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +18 -13
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +19 -13
- data/lib/elasticsearch/api/actions/tasks/get.rb +16 -13
- data/lib/elasticsearch/api/actions/tasks/list.rb +20 -18
- data/lib/elasticsearch/api/actions/tasks/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/termvectors.rb +52 -70
- data/lib/elasticsearch/api/actions/update.rb +53 -98
- data/lib/elasticsearch/api/actions/update_by_query.rb +77 -66
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +17 -11
- data/lib/elasticsearch/api/version.rb +1 -1
- data/spec/elasticsearch/api/actions/cat/segments_spec.rb +9 -11
- data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/count_spec.rb +8 -8
- data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +12 -7
- data/spec/elasticsearch/api/actions/delete_script_spec.rb +0 -14
- data/spec/elasticsearch/api/actions/exists_document_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/get_document_source_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/index_document_spec.rb +6 -15
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -4
- data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +1 -5
- data/spec/elasticsearch/api/actions/indices/clone_spec.rb +109 -0
- data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +2 -2
- data/spec/elasticsearch/api/actions/indices/get_spec.rb +0 -11
- data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -1
- data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/put_script_spec.rb +20 -15
- data/spec/elasticsearch/api/actions/render_search_template_spec.rb +23 -7
- data/spec/elasticsearch/api/actions/scroll_spec.rb +37 -0
- data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/tasks/list_spec.rb +0 -11
- data/spec/elasticsearch/api/actions/update_document_spec.rb +3 -7
- data/spec/elasticsearch/api/rest_api_yaml_spec.rb +1 -1
- data/spec/rest_yaml_tests_helper.rb +12 -0
- data/utils/Gemfile +1 -0
- data/utils/Thorfile +0 -1
- data/utils/thor/generate_source.rb +192 -85
- data/utils/thor/generator/endpoint_specifics.rb +157 -0
- data/utils/thor/generator/files_helper.rb +37 -0
- data/utils/thor/lister.rb +3 -4
- data/utils/thor/templates/_documentation_top.erb +27 -0
- data/utils/thor/templates/_method_setup.erb +35 -0
- data/utils/thor/templates/_params_registry.erb +12 -0
- data/utils/thor/templates/_perform_request.erb +37 -0
- data/utils/thor/templates/method.erb +59 -0
- data/utils/thor/templates/{ruby/test.erb → test.erb} +0 -0
- data/utils/thor/templates/{ruby/test_helper.rb → test_helper.rb} +0 -0
- metadata +31 -14
- data/spec/elasticsearch/api/actions/scoll_spec.rb +0 -21
- data/utils/thor/generate_api.rb +0 -193
- data/utils/thor/templates/ruby/method.erb +0 -62
|
@@ -6,47 +6,42 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Create a repository for storing snapshots
|
|
11
|
-
#
|
|
12
|
-
# @example Create a repository at `/tmp/backup`
|
|
9
|
+
# Creates a repository.
|
|
13
10
|
#
|
|
14
|
-
#
|
|
15
|
-
# body: {
|
|
16
|
-
# type: 'fs',
|
|
17
|
-
# settings: { location: '/tmp/backup', compress: true }
|
|
18
|
-
# }
|
|
19
|
-
#
|
|
20
|
-
# @option arguments [String] :repository A repository name (*Required*)
|
|
21
|
-
# @option arguments [Hash] :body The repository definition (*Required*)
|
|
11
|
+
# @option arguments [String] :repository A repository name
|
|
22
12
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
23
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
|
24
14
|
# @option arguments [Boolean] :verify Whether to verify the repository after creation
|
|
15
|
+
|
|
16
|
+
# @option arguments [Hash] :body The repository definition (*Required*)
|
|
25
17
|
#
|
|
26
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
18
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
27
19
|
#
|
|
28
|
-
def create_repository(arguments={})
|
|
20
|
+
def create_repository(arguments = {})
|
|
21
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
29
22
|
raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
|
|
30
|
-
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
|
31
|
-
repository = arguments.delete(:repository)
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
path = Utils.__pathify( '_snapshot', Utils.__escape(repository) )
|
|
24
|
+
arguments = arguments.clone
|
|
35
25
|
|
|
26
|
+
_repository = arguments.delete(:repository)
|
|
27
|
+
|
|
28
|
+
method = Elasticsearch::API::HTTP_PUT
|
|
29
|
+
path = "_snapshot/#{Utils.__listify(_repository)}"
|
|
36
30
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
37
|
-
body = arguments[:body]
|
|
38
31
|
|
|
32
|
+
body = arguments[:body]
|
|
39
33
|
perform_request(method, path, params, body).body
|
|
40
34
|
end
|
|
41
35
|
|
|
42
36
|
# Register this action with its valid params when the module is loaded.
|
|
43
37
|
#
|
|
44
|
-
# @since 6.
|
|
38
|
+
# @since 6.2.0
|
|
45
39
|
ParamsRegistry.register(:create_repository, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
:master_timeout,
|
|
41
|
+
:timeout,
|
|
42
|
+
:verify
|
|
43
|
+
].freeze)
|
|
44
|
+
end
|
|
49
45
|
end
|
|
50
|
-
end
|
|
51
46
|
end
|
|
52
47
|
end
|
|
@@ -6,34 +6,30 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Delete a snapshot from the repository
|
|
11
|
-
#
|
|
12
|
-
# @note Will also abort a currently running snapshot.
|
|
13
|
-
#
|
|
14
|
-
# @example Delete the `snapshot-1` snapshot
|
|
15
|
-
#
|
|
16
|
-
# client.snapshot.delete repository: 'my-backups', snapshot: 'snapshot-1'
|
|
9
|
+
# Deletes a snapshot.
|
|
17
10
|
#
|
|
18
|
-
# @option arguments [String] :repository A repository name
|
|
19
|
-
# @option arguments [String] :snapshot A snapshot name
|
|
11
|
+
# @option arguments [String] :repository A repository name
|
|
12
|
+
# @option arguments [String] :snapshot A snapshot name
|
|
20
13
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
21
|
-
|
|
14
|
+
|
|
22
15
|
#
|
|
23
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
24
17
|
#
|
|
25
|
-
def delete(arguments={})
|
|
18
|
+
def delete(arguments = {})
|
|
26
19
|
raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
|
|
27
|
-
raise ArgumentError, "Required argument 'snapshot' missing"
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
|
|
21
|
+
|
|
22
|
+
arguments = arguments.clone
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__listify(snapshot) )
|
|
24
|
+
_repository = arguments.delete(:repository)
|
|
33
25
|
|
|
26
|
+
_snapshot = arguments.delete(:snapshot)
|
|
27
|
+
|
|
28
|
+
method = Elasticsearch::API::HTTP_DELETE
|
|
29
|
+
path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}"
|
|
34
30
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
35
|
-
body = nil
|
|
36
31
|
|
|
32
|
+
body = nil
|
|
37
33
|
if Array(arguments[:ignore]).include?(404)
|
|
38
34
|
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
|
39
35
|
else
|
|
@@ -43,9 +39,11 @@ module Elasticsearch
|
|
|
43
39
|
|
|
44
40
|
# Register this action with its valid params when the module is loaded.
|
|
45
41
|
#
|
|
46
|
-
# @since 6.
|
|
47
|
-
ParamsRegistry.register(:delete, [
|
|
42
|
+
# @since 6.2.0
|
|
43
|
+
ParamsRegistry.register(:delete, [
|
|
44
|
+
:master_timeout
|
|
45
|
+
].freeze)
|
|
46
|
+
end
|
|
48
47
|
end
|
|
49
|
-
end
|
|
50
48
|
end
|
|
51
49
|
end
|
|
@@ -6,30 +6,27 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Delete a specific repository or repositories
|
|
11
|
-
#
|
|
12
|
-
# @example Delete the `my-backups` repository
|
|
13
|
-
#
|
|
14
|
-
# client.snapshot.delete_repository repository: 'my-backups'
|
|
9
|
+
# Deletes a repository.
|
|
15
10
|
#
|
|
16
|
-
# @option arguments [List] :repository A comma-separated list of repository names
|
|
11
|
+
# @option arguments [List] :repository A comma-separated list of repository names
|
|
17
12
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
18
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
|
19
|
-
|
|
14
|
+
|
|
20
15
|
#
|
|
21
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
22
17
|
#
|
|
23
|
-
def delete_repository(arguments={})
|
|
18
|
+
def delete_repository(arguments = {})
|
|
24
19
|
raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
|
|
25
|
-
repository = arguments.delete(:repository)
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
arguments = arguments.clone
|
|
22
|
+
|
|
23
|
+
_repository = arguments.delete(:repository)
|
|
29
24
|
|
|
25
|
+
method = Elasticsearch::API::HTTP_DELETE
|
|
26
|
+
path = "_snapshot/#{Utils.__listify(_repository)}"
|
|
30
27
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
31
|
-
body = nil
|
|
32
28
|
|
|
29
|
+
body = nil
|
|
33
30
|
if Array(arguments[:ignore]).include?(404)
|
|
34
31
|
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
|
35
32
|
else
|
|
@@ -39,11 +36,12 @@ module Elasticsearch
|
|
|
39
36
|
|
|
40
37
|
# Register this action with its valid params when the module is loaded.
|
|
41
38
|
#
|
|
42
|
-
# @since 6.
|
|
39
|
+
# @since 6.2.0
|
|
43
40
|
ParamsRegistry.register(:delete_repository, [
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
:master_timeout,
|
|
42
|
+
:timeout
|
|
43
|
+
].freeze)
|
|
44
|
+
end
|
|
46
45
|
end
|
|
47
|
-
end
|
|
48
46
|
end
|
|
49
47
|
end
|
|
@@ -6,42 +6,32 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Return information about specific (or all) snapshots
|
|
11
|
-
#
|
|
12
|
-
# @example Return information about the `snapshot-2` snapshot
|
|
13
|
-
#
|
|
14
|
-
# client.snapshot.get repository: 'my-backup', snapshot: 'snapshot-2'
|
|
15
|
-
#
|
|
16
|
-
# @example Return information about multiple snapshots
|
|
17
|
-
#
|
|
18
|
-
# client.snapshot.get repository: 'my-backup', snapshot: ['snapshot-2', 'snapshot-3']
|
|
19
|
-
#
|
|
20
|
-
# @example Return information about all snapshots in the repository
|
|
9
|
+
# Returns information about a snapshot.
|
|
21
10
|
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
# @option arguments [String] :repository A repository name (*Required*)
|
|
25
|
-
# @option arguments [List] :snapshot A comma-separated list of snapshot names (*Required*)
|
|
26
|
-
# @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to
|
|
27
|
-
# false which means a SnapshotMissingException is thrown
|
|
11
|
+
# @option arguments [String] :repository A repository name
|
|
12
|
+
# @option arguments [List] :snapshot A comma-separated list of snapshot names
|
|
28
13
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
14
|
+
# @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
|
|
29
15
|
# @option arguments [Boolean] :verbose Whether to show verbose snapshot info or only show the basic info found in the repository index blob
|
|
16
|
+
|
|
30
17
|
#
|
|
31
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
18
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
32
19
|
#
|
|
33
|
-
def get(arguments={})
|
|
20
|
+
def get(arguments = {})
|
|
34
21
|
raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
|
|
35
|
-
raise ArgumentError, "Required argument 'snapshot' missing"
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
|
|
23
|
+
|
|
24
|
+
arguments = arguments.clone
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__listify(snapshot) )
|
|
26
|
+
_repository = arguments.delete(:repository)
|
|
41
27
|
|
|
28
|
+
_snapshot = arguments.delete(:snapshot)
|
|
29
|
+
|
|
30
|
+
method = Elasticsearch::API::HTTP_GET
|
|
31
|
+
path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}"
|
|
42
32
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
43
|
-
body = nil
|
|
44
33
|
|
|
34
|
+
body = nil
|
|
45
35
|
if Array(arguments[:ignore]).include?(404)
|
|
46
36
|
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
|
47
37
|
else
|
|
@@ -51,12 +41,13 @@ module Elasticsearch
|
|
|
51
41
|
|
|
52
42
|
# Register this action with its valid params when the module is loaded.
|
|
53
43
|
#
|
|
54
|
-
# @since 6.
|
|
44
|
+
# @since 6.2.0
|
|
55
45
|
ParamsRegistry.register(:get, [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
:master_timeout,
|
|
47
|
+
:ignore_unavailable,
|
|
48
|
+
:verbose
|
|
49
|
+
].freeze)
|
|
50
|
+
end
|
|
59
51
|
end
|
|
60
|
-
end
|
|
61
52
|
end
|
|
62
53
|
end
|
|
@@ -6,34 +6,29 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Get information about snapshot repositories or a specific repository
|
|
11
|
-
#
|
|
12
|
-
# @example Get all repositories
|
|
13
|
-
#
|
|
14
|
-
# client.snapshot.get_repository
|
|
15
|
-
#
|
|
16
|
-
# @example Get a specific repository
|
|
17
|
-
#
|
|
18
|
-
# client.snapshot.get_repository repository: 'my-backups'
|
|
9
|
+
# Returns information about a repository.
|
|
19
10
|
#
|
|
20
|
-
# @option arguments [List] :repository A comma-separated list of repository names
|
|
21
|
-
# to get a list of repositories
|
|
11
|
+
# @option arguments [List] :repository A comma-separated list of repository names
|
|
22
12
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
23
|
-
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
|
24
|
-
|
|
25
|
-
# @option arguments [Number,List] :ignore The list of HTTP errors to ignore
|
|
13
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
|
|
14
|
+
|
|
26
15
|
#
|
|
27
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
28
17
|
#
|
|
29
|
-
def get_repository(arguments={})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
def get_repository(arguments = {})
|
|
19
|
+
arguments = arguments.clone
|
|
20
|
+
|
|
21
|
+
_repository = arguments.delete(:repository)
|
|
33
22
|
|
|
23
|
+
method = Elasticsearch::API::HTTP_GET
|
|
24
|
+
path = if _repository
|
|
25
|
+
"_snapshot/#{Utils.__listify(_repository)}"
|
|
26
|
+
else
|
|
27
|
+
"_snapshot"
|
|
28
|
+
end
|
|
34
29
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
35
|
-
body = nil
|
|
36
30
|
|
|
31
|
+
body = nil
|
|
37
32
|
if Array(arguments[:ignore]).include?(404)
|
|
38
33
|
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
|
39
34
|
else
|
|
@@ -43,11 +38,12 @@ module Elasticsearch
|
|
|
43
38
|
|
|
44
39
|
# Register this action with its valid params when the module is loaded.
|
|
45
40
|
#
|
|
46
|
-
# @since 6.
|
|
41
|
+
# @since 6.2.0
|
|
47
42
|
ParamsRegistry.register(:get_repository, [
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
:master_timeout,
|
|
44
|
+
:local
|
|
45
|
+
].freeze)
|
|
46
|
+
end
|
|
50
47
|
end
|
|
51
|
-
end
|
|
52
48
|
end
|
|
53
49
|
end
|
|
@@ -6,54 +6,43 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Restore the state from a snapshot
|
|
11
|
-
#
|
|
12
|
-
# @example Restore from the `snapshot-1` snapshot
|
|
13
|
-
#
|
|
14
|
-
# client.snapshot.restore repository: 'my-backups', snapshot: 'snapshot-1'
|
|
15
|
-
#
|
|
16
|
-
# @example Restore a specific index under a different name
|
|
17
|
-
#
|
|
18
|
-
# client.snapshot.restore repository: 'my-backups',
|
|
19
|
-
# snapshot: 'snapshot-1',
|
|
20
|
-
# body: {
|
|
21
|
-
# rename_pattern: "^(.*)$",
|
|
22
|
-
# rename_replacement: "restored_$1"
|
|
23
|
-
# }
|
|
24
|
-
#
|
|
25
|
-
# @note You cannot restore into an open index, you have to {Indices::Actions#close} it first
|
|
9
|
+
# Restores a snapshot.
|
|
26
10
|
#
|
|
27
|
-
# @option arguments [String] :repository A repository name
|
|
28
|
-
# @option arguments [String] :snapshot A snapshot name
|
|
29
|
-
# @option arguments [Hash] :body Details of what to restore
|
|
11
|
+
# @option arguments [String] :repository A repository name
|
|
12
|
+
# @option arguments [String] :snapshot A snapshot name
|
|
30
13
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
31
14
|
# @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning
|
|
15
|
+
|
|
16
|
+
# @option arguments [Hash] :body Details of what to restore
|
|
32
17
|
#
|
|
33
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
18
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
34
19
|
#
|
|
35
|
-
def restore(arguments={})
|
|
20
|
+
def restore(arguments = {})
|
|
36
21
|
raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
|
|
37
|
-
raise ArgumentError, "Required argument 'snapshot' missing"
|
|
38
|
-
repository = arguments.delete(:repository)
|
|
39
|
-
snapshot = arguments.delete(:snapshot)
|
|
22
|
+
raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__escape(snapshot), '_restore' )
|
|
24
|
+
arguments = arguments.clone
|
|
43
25
|
|
|
26
|
+
_repository = arguments.delete(:repository)
|
|
27
|
+
|
|
28
|
+
_snapshot = arguments.delete(:snapshot)
|
|
29
|
+
|
|
30
|
+
method = Elasticsearch::API::HTTP_POST
|
|
31
|
+
path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}/_restore"
|
|
44
32
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
45
|
-
body = arguments[:body]
|
|
46
33
|
|
|
34
|
+
body = arguments[:body]
|
|
47
35
|
perform_request(method, path, params, body).body
|
|
48
36
|
end
|
|
49
37
|
|
|
50
38
|
# Register this action with its valid params when the module is loaded.
|
|
51
39
|
#
|
|
52
|
-
# @since 6.
|
|
40
|
+
# @since 6.2.0
|
|
53
41
|
ParamsRegistry.register(:restore, [
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
:master_timeout,
|
|
43
|
+
:wait_for_completion
|
|
44
|
+
].freeze)
|
|
45
|
+
end
|
|
56
46
|
end
|
|
57
|
-
end
|
|
58
47
|
end
|
|
59
48
|
end
|
|
@@ -6,36 +6,34 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Return information about a running snapshot
|
|
11
|
-
#
|
|
12
|
-
# @example Return information about all currently running snapshots
|
|
13
|
-
#
|
|
14
|
-
# client.snapshot.status repository: 'my-backups', human: true
|
|
15
|
-
#
|
|
16
|
-
# @example Return information about a specific snapshot
|
|
17
|
-
#
|
|
18
|
-
# client.snapshot.status repository: 'my-backups', human: true
|
|
9
|
+
# Returns information about the status of a snapshot.
|
|
19
10
|
#
|
|
20
11
|
# @option arguments [String] :repository A repository name
|
|
21
12
|
# @option arguments [List] :snapshot A comma-separated list of snapshot names
|
|
22
|
-
# @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to
|
|
23
|
-
# false which means a SnapshotMissingException is thrown
|
|
24
13
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
25
|
-
# @option arguments [
|
|
14
|
+
# @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown
|
|
15
|
+
|
|
26
16
|
#
|
|
27
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
17
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
28
18
|
#
|
|
29
|
-
def status(arguments={})
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
def status(arguments = {})
|
|
20
|
+
arguments = arguments.clone
|
|
21
|
+
|
|
22
|
+
_repository = arguments.delete(:repository)
|
|
32
23
|
|
|
33
|
-
|
|
24
|
+
_snapshot = arguments.delete(:snapshot)
|
|
34
25
|
|
|
35
|
-
|
|
26
|
+
method = Elasticsearch::API::HTTP_GET
|
|
27
|
+
path = if _repository && _snapshot
|
|
28
|
+
"_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}/_status"
|
|
29
|
+
elsif _repository
|
|
30
|
+
"_snapshot/#{Utils.__listify(_repository)}/_status"
|
|
31
|
+
else
|
|
32
|
+
"_snapshot/_status"
|
|
33
|
+
end
|
|
36
34
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
37
|
-
body = nil
|
|
38
35
|
|
|
36
|
+
body = nil
|
|
39
37
|
if Array(arguments[:ignore]).include?(404)
|
|
40
38
|
Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
|
|
41
39
|
else
|
|
@@ -45,11 +43,12 @@ module Elasticsearch
|
|
|
45
43
|
|
|
46
44
|
# Register this action with its valid params when the module is loaded.
|
|
47
45
|
#
|
|
48
|
-
# @since 6.
|
|
46
|
+
# @since 6.2.0
|
|
49
47
|
ParamsRegistry.register(:status, [
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
:master_timeout,
|
|
49
|
+
:ignore_unavailable
|
|
50
|
+
].freeze)
|
|
51
|
+
end
|
|
52
52
|
end
|
|
53
|
-
end
|
|
54
53
|
end
|
|
55
54
|
end
|
|
@@ -6,33 +6,38 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Snapshot
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Explicitly perform the verification of a repository
|
|
9
|
+
# Verifies a repository.
|
|
11
10
|
#
|
|
12
|
-
# @option arguments [String] :repository A repository name
|
|
11
|
+
# @option arguments [String] :repository A repository name
|
|
13
12
|
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
|
14
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
|
14
|
+
|
|
15
15
|
#
|
|
16
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
|
|
17
17
|
#
|
|
18
|
-
def verify_repository(arguments={})
|
|
18
|
+
def verify_repository(arguments = {})
|
|
19
19
|
raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
arguments = arguments.clone
|
|
22
|
+
|
|
23
|
+
_repository = arguments.delete(:repository)
|
|
24
|
+
|
|
25
|
+
method = Elasticsearch::API::HTTP_POST
|
|
26
|
+
path = "_snapshot/#{Utils.__listify(_repository)}/_verify"
|
|
23
27
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
24
|
-
body = nil
|
|
25
28
|
|
|
29
|
+
body = nil
|
|
26
30
|
perform_request(method, path, params, body).body
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
# Register this action with its valid params when the module is loaded.
|
|
30
34
|
#
|
|
31
|
-
# @since 6.
|
|
35
|
+
# @since 6.2.0
|
|
32
36
|
ParamsRegistry.register(:verify_repository, [
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
:master_timeout,
|
|
38
|
+
:timeout
|
|
39
|
+
].freeze)
|
|
40
|
+
end
|
|
35
41
|
end
|
|
36
|
-
end
|
|
37
42
|
end
|
|
38
43
|
end
|
|
@@ -6,36 +6,42 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Tasks
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Cancel a specific task
|
|
9
|
+
# Cancels a task, if it can be cancelled through an API.
|
|
11
10
|
#
|
|
12
11
|
# @option arguments [String] :task_id Cancel the task with specified task id (node_id:task_number)
|
|
13
12
|
# @option arguments [List] :nodes A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
|
|
14
13
|
# @option arguments [List] :actions A comma-separated list of actions that should be cancelled. Leave empty to cancel all.
|
|
15
14
|
# @option arguments [String] :parent_task_id Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all.
|
|
15
|
+
|
|
16
16
|
#
|
|
17
|
-
# @see
|
|
17
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/tasks.html
|
|
18
18
|
#
|
|
19
|
-
def cancel(arguments={})
|
|
19
|
+
def cancel(arguments = {})
|
|
20
20
|
arguments = arguments.clone
|
|
21
|
-
task_id = arguments.delete(:task_id)
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
_task_id = arguments.delete(:task_id)
|
|
23
|
+
|
|
24
|
+
method = Elasticsearch::API::HTTP_POST
|
|
25
|
+
path = if _task_id
|
|
26
|
+
"_tasks/#{Utils.__listify(_task_id)}/_cancel"
|
|
27
|
+
else
|
|
28
|
+
"_tasks/_cancel"
|
|
29
|
+
end
|
|
25
30
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
26
|
-
body = nil
|
|
27
31
|
|
|
32
|
+
body = nil
|
|
28
33
|
perform_request(method, path, params, body).body
|
|
29
34
|
end
|
|
30
35
|
|
|
31
36
|
# Register this action with its valid params when the module is loaded.
|
|
32
37
|
#
|
|
33
|
-
# @since 6.
|
|
38
|
+
# @since 6.2.0
|
|
34
39
|
ParamsRegistry.register(:cancel, [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
:nodes,
|
|
41
|
+
:actions,
|
|
42
|
+
:parent_task_id
|
|
43
|
+
].freeze)
|
|
44
|
+
end
|
|
38
45
|
end
|
|
39
|
-
end
|
|
40
46
|
end
|
|
41
47
|
end
|
|
@@ -6,33 +6,36 @@ module Elasticsearch
|
|
|
6
6
|
module API
|
|
7
7
|
module Tasks
|
|
8
8
|
module Actions
|
|
9
|
-
|
|
10
|
-
# Return information about a specific task
|
|
9
|
+
# Returns information about a task.
|
|
11
10
|
#
|
|
12
|
-
# @option arguments [String] :task_id Return the task with specified id (node_id:task_number)
|
|
11
|
+
# @option arguments [String] :task_id Return the task with specified id (node_id:task_number)
|
|
13
12
|
# @option arguments [Boolean] :wait_for_completion Wait for the matching tasks to complete (default: false)
|
|
14
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
|
14
|
+
|
|
15
15
|
#
|
|
16
|
-
# @see
|
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/tasks.html
|
|
17
17
|
#
|
|
18
|
-
def get(arguments={})
|
|
18
|
+
def get(arguments = {})
|
|
19
19
|
arguments = arguments.clone
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
_task_id = arguments.delete(:task_id)
|
|
22
|
+
|
|
23
|
+
method = Elasticsearch::API::HTTP_GET
|
|
24
|
+
path = "_tasks/#{Utils.__listify(_task_id)}"
|
|
23
25
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
24
|
-
body = nil
|
|
25
26
|
|
|
27
|
+
body = nil
|
|
26
28
|
perform_request(method, path, params, body).body
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
# Register this action with its valid params when the module is loaded.
|
|
30
32
|
#
|
|
31
|
-
# @since 6.
|
|
33
|
+
# @since 6.2.0
|
|
32
34
|
ParamsRegistry.register(:get, [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
:wait_for_completion,
|
|
36
|
+
:timeout
|
|
37
|
+
].freeze)
|
|
38
|
+
end
|
|
35
39
|
end
|
|
36
|
-
end
|
|
37
40
|
end
|
|
38
41
|
end
|