elasticsearch-api 7.4.0 → 7.5.0.pre.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +16 -23
  3. data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -2
  4. data/lib/elasticsearch/api/actions/benchmark.rb +2 -3
  5. data/lib/elasticsearch/api/actions/bulk.rb +35 -68
  6. data/lib/elasticsearch/api/actions/cat/aliases.rb +30 -52
  7. data/lib/elasticsearch/api/actions/cat/allocation.rb +36 -50
  8. data/lib/elasticsearch/api/actions/cat/count.rb +25 -46
  9. data/lib/elasticsearch/api/actions/cat/fielddata.rb +31 -33
  10. data/lib/elasticsearch/api/actions/cat/health.rb +27 -37
  11. data/lib/elasticsearch/api/actions/cat/help.rb +14 -10
  12. data/lib/elasticsearch/api/actions/cat/indices.rb +45 -62
  13. data/lib/elasticsearch/api/actions/cat/master.rb +24 -34
  14. data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +20 -16
  15. data/lib/elasticsearch/api/actions/cat/nodes.rb +34 -46
  16. data/lib/elasticsearch/api/actions/cat/params_registry.rb +0 -1
  17. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +29 -35
  18. data/lib/elasticsearch/api/actions/cat/plugins.rb +21 -18
  19. data/lib/elasticsearch/api/actions/cat/recovery.rb +40 -56
  20. data/lib/elasticsearch/api/actions/cat/repositories.rb +21 -24
  21. data/lib/elasticsearch/api/actions/cat/segments.rb +29 -22
  22. data/lib/elasticsearch/api/actions/cat/shards.rb +38 -59
  23. data/lib/elasticsearch/api/actions/cat/snapshots.rb +32 -27
  24. data/lib/elasticsearch/api/actions/cat/tasks.rb +25 -19
  25. data/lib/elasticsearch/api/actions/cat/templates.rb +26 -18
  26. data/lib/elasticsearch/api/actions/cat/thread_pool.rb +36 -46
  27. data/lib/elasticsearch/api/actions/clear_scroll.rb +21 -8
  28. data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +15 -13
  29. data/lib/elasticsearch/api/actions/cluster/get_settings.rb +18 -18
  30. data/lib/elasticsearch/api/actions/cluster/health.rb +42 -44
  31. data/lib/elasticsearch/api/actions/cluster/params_registry.rb +0 -1
  32. data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +15 -17
  33. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +20 -17
  34. data/lib/elasticsearch/api/actions/cluster/remote_info.rb +8 -6
  35. data/lib/elasticsearch/api/actions/cluster/reroute.rb +25 -37
  36. data/lib/elasticsearch/api/actions/cluster/state.rb +37 -41
  37. data/lib/elasticsearch/api/actions/cluster/stats.rb +20 -12
  38. data/lib/elasticsearch/api/actions/count.rb +52 -39
  39. data/lib/elasticsearch/api/actions/create.rb +25 -26
  40. data/lib/elasticsearch/api/actions/delete.rb +43 -36
  41. data/lib/elasticsearch/api/actions/delete_by_query.rb +74 -62
  42. data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +39 -0
  43. data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +4 -3
  44. data/lib/elasticsearch/api/actions/delete_script.rb +19 -13
  45. data/lib/elasticsearch/api/actions/exists.rb +44 -34
  46. data/lib/elasticsearch/api/actions/exists_source.rb +43 -25
  47. data/lib/elasticsearch/api/actions/explain.rb +46 -51
  48. data/lib/elasticsearch/api/actions/field_caps.rb +27 -20
  49. data/lib/elasticsearch/api/actions/get.rb +42 -41
  50. data/lib/elasticsearch/api/actions/get_script.rb +19 -14
  51. data/lib/elasticsearch/api/actions/get_source.rb +38 -44
  52. data/lib/elasticsearch/api/actions/index.rb +60 -89
  53. data/lib/elasticsearch/api/actions/indices/analyze.rb +19 -48
  54. data/lib/elasticsearch/api/actions/indices/clear_cache.rb +29 -41
  55. data/lib/elasticsearch/api/actions/indices/clone.rb +21 -21
  56. data/lib/elasticsearch/api/actions/indices/close.rb +28 -32
  57. data/lib/elasticsearch/api/actions/indices/create.rb +22 -70
  58. data/lib/elasticsearch/api/actions/indices/delete.rb +23 -35
  59. data/lib/elasticsearch/api/actions/indices/delete_alias.rb +24 -20
  60. data/lib/elasticsearch/api/actions/indices/delete_template.rb +18 -20
  61. data/lib/elasticsearch/api/actions/indices/exists.rb +32 -34
  62. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +33 -29
  63. data/lib/elasticsearch/api/actions/indices/exists_template.rb +21 -16
  64. data/lib/elasticsearch/api/actions/indices/exists_type.rb +29 -29
  65. data/lib/elasticsearch/api/actions/indices/flush.rb +28 -28
  66. data/lib/elasticsearch/api/actions/indices/flush_synced.rb +23 -12
  67. data/lib/elasticsearch/api/actions/indices/forcemerge.rb +26 -41
  68. data/lib/elasticsearch/api/actions/indices/freeze.rb +7 -8
  69. data/lib/elasticsearch/api/actions/indices/get.rb +25 -19
  70. data/lib/elasticsearch/api/actions/indices/get_alias.rb +31 -23
  71. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +42 -38
  72. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +39 -31
  73. data/lib/elasticsearch/api/actions/indices/get_settings.rb +34 -37
  74. data/lib/elasticsearch/api/actions/indices/get_template.rb +21 -23
  75. data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +48 -0
  76. data/lib/elasticsearch/api/actions/indices/open.rb +24 -21
  77. data/lib/elasticsearch/api/actions/indices/params_registry.rb +0 -1
  78. data/lib/elasticsearch/api/actions/indices/put_alias.rb +25 -27
  79. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +40 -39
  80. data/lib/elasticsearch/api/actions/indices/put_settings.rb +30 -37
  81. data/lib/elasticsearch/api/actions/indices/put_template.rb +23 -23
  82. data/lib/elasticsearch/api/actions/indices/recovery.rb +20 -23
  83. data/lib/elasticsearch/api/actions/indices/refresh.rb +22 -26
  84. data/lib/elasticsearch/api/actions/indices/rollover.rb +28 -19
  85. data/lib/elasticsearch/api/actions/indices/segments.rb +24 -17
  86. data/lib/elasticsearch/api/actions/indices/shard_stores.rb +27 -15
  87. data/lib/elasticsearch/api/actions/indices/shrink.rb +23 -17
  88. data/lib/elasticsearch/api/actions/indices/split.rb +23 -17
  89. data/lib/elasticsearch/api/actions/indices/stats.rb +53 -104
  90. data/lib/elasticsearch/api/actions/indices/unfreeze.rb +7 -7
  91. data/lib/elasticsearch/api/actions/indices/update_aliases.rb +15 -32
  92. data/lib/elasticsearch/api/actions/indices/upgrade.rb +26 -16
  93. data/lib/elasticsearch/api/actions/indices/validate_query.rb +46 -59
  94. data/lib/elasticsearch/api/actions/info.rb +9 -6
  95. data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +18 -12
  96. data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +21 -11
  97. data/lib/elasticsearch/api/actions/ingest/params_registry.rb +0 -1
  98. data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +12 -13
  99. data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +19 -14
  100. data/lib/elasticsearch/api/actions/ingest/simulate.rb +23 -13
  101. data/lib/elasticsearch/api/actions/mget.rb +37 -44
  102. data/lib/elasticsearch/api/actions/msearch.rb +54 -54
  103. data/lib/elasticsearch/api/actions/msearch_template.rb +46 -35
  104. data/lib/elasticsearch/api/actions/mtermvectors.rb +39 -35
  105. data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +30 -25
  106. data/lib/elasticsearch/api/actions/nodes/info.rb +29 -63
  107. data/lib/elasticsearch/api/actions/nodes/params_registry.rb +0 -1
  108. data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +24 -22
  109. data/lib/elasticsearch/api/actions/nodes/shutdown.rb +4 -4
  110. data/lib/elasticsearch/api/actions/nodes/stats.rb +43 -36
  111. data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -10
  112. data/lib/elasticsearch/api/actions/params_registry.rb +0 -1
  113. data/lib/elasticsearch/api/actions/ping.rb +12 -13
  114. data/lib/elasticsearch/api/actions/put_script.rb +26 -30
  115. data/lib/elasticsearch/api/actions/rank_eval.rb +24 -15
  116. data/lib/elasticsearch/api/actions/reindex.rb +25 -48
  117. data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +18 -12
  118. data/lib/elasticsearch/api/actions/remote/info.rb +1 -2
  119. data/lib/elasticsearch/api/actions/render_search_template.rb +17 -15
  120. data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +8 -6
  121. data/lib/elasticsearch/api/actions/scroll.rb +28 -51
  122. data/lib/elasticsearch/api/actions/search.rb +104 -165
  123. data/lib/elasticsearch/api/actions/search_shards.rb +31 -28
  124. data/lib/elasticsearch/api/actions/search_template.rb +48 -40
  125. data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +44 -0
  126. data/lib/elasticsearch/api/actions/snapshot/create.rb +22 -29
  127. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +19 -24
  128. data/lib/elasticsearch/api/actions/snapshot/delete.rb +20 -22
  129. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +16 -18
  130. data/lib/elasticsearch/api/actions/snapshot/get.rb +22 -31
  131. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +21 -25
  132. data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +0 -1
  133. data/lib/elasticsearch/api/actions/snapshot/restore.rb +21 -32
  134. data/lib/elasticsearch/api/actions/snapshot/status.rb +23 -24
  135. data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +18 -13
  136. data/lib/elasticsearch/api/actions/tasks/cancel.rb +19 -13
  137. data/lib/elasticsearch/api/actions/tasks/get.rb +16 -13
  138. data/lib/elasticsearch/api/actions/tasks/list.rb +20 -18
  139. data/lib/elasticsearch/api/actions/tasks/params_registry.rb +0 -1
  140. data/lib/elasticsearch/api/actions/termvectors.rb +52 -70
  141. data/lib/elasticsearch/api/actions/update.rb +53 -98
  142. data/lib/elasticsearch/api/actions/update_by_query.rb +77 -66
  143. data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +17 -11
  144. data/lib/elasticsearch/api/version.rb +1 -1
  145. data/spec/elasticsearch/api/actions/cat/segments_spec.rb +9 -11
  146. data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +1 -1
  147. data/spec/elasticsearch/api/actions/count_spec.rb +8 -8
  148. data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +12 -7
  149. data/spec/elasticsearch/api/actions/delete_script_spec.rb +0 -14
  150. data/spec/elasticsearch/api/actions/exists_document_spec.rb +1 -1
  151. data/spec/elasticsearch/api/actions/get_document_source_spec.rb +1 -1
  152. data/spec/elasticsearch/api/actions/index_document_spec.rb +6 -15
  153. data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -4
  154. data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +1 -5
  155. data/spec/elasticsearch/api/actions/indices/clone_spec.rb +1 -1
  156. data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +2 -2
  157. data/spec/elasticsearch/api/actions/indices/get_spec.rb +0 -11
  158. data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +3 -3
  159. data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +3 -3
  160. data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -1
  161. data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +3 -3
  162. data/spec/elasticsearch/api/actions/put_script_spec.rb +20 -15
  163. data/spec/elasticsearch/api/actions/render_search_template_spec.rb +23 -7
  164. data/spec/elasticsearch/api/actions/scroll_spec.rb +37 -0
  165. data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
  166. data/spec/elasticsearch/api/actions/tasks/list_spec.rb +0 -11
  167. data/spec/elasticsearch/api/actions/update_document_spec.rb +3 -7
  168. data/spec/rest_yaml_tests_helper.rb +12 -0
  169. data/utils/Gemfile +1 -0
  170. data/utils/Thorfile +0 -1
  171. data/utils/thor/generate_source.rb +192 -85
  172. data/utils/thor/generator/endpoint_specifics.rb +157 -0
  173. data/utils/thor/generator/files_helper.rb +37 -0
  174. data/utils/thor/lister.rb +3 -4
  175. data/utils/thor/templates/_documentation_top.erb +27 -0
  176. data/utils/thor/templates/_method_setup.erb +35 -0
  177. data/utils/thor/templates/_params_registry.erb +12 -0
  178. data/utils/thor/templates/_perform_request.erb +37 -0
  179. data/utils/thor/templates/method.erb +59 -0
  180. data/utils/thor/templates/{ruby/test.erb → test.erb} +0 -0
  181. data/utils/thor/templates/{ruby/test_helper.rb → test_helper.rb} +0 -0
  182. metadata +19 -11
  183. data/spec/elasticsearch/api/actions/scoll_spec.rb +0 -21
  184. data/utils/thor/generate_api.rb +0 -193
  185. data/utils/thor/templates/ruby/method.erb +0 -62
@@ -5,68 +5,76 @@
5
5
  module Elasticsearch
6
6
  module API
7
7
  module Actions
8
-
9
- # Configure the search definition witha template in Mustache and parameters
10
- #
11
- # @example Insert the start and end values for the `range` query
12
- #
13
- # client.search_template index: 'myindex',
14
- # body: {
15
- # template: {
16
- # query: {
17
- # range: {
18
- # date: { gte: "{{start}}", lte: "{{end}}" }
19
- # }
20
- # }
21
- # },
22
- # params: { start: "2014-02-01", end: "2014-03-01" }
23
- # }
8
+ # Allows to use the Mustache language to pre-render a search definition.
24
9
  #
25
10
  # @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
26
11
  # @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types
27
- # @option arguments [Hash] :body The search definition template and its params (*Required*)
28
12
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
29
13
  # @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled
30
14
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
31
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
15
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
16
+ # (options: open,closed,none,all)
17
+
32
18
  # @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random)
33
19
  # @option arguments [List] :routing A comma-separated list of specific routing values
34
20
  # @option arguments [Time] :scroll Specify how long a consistent view of the index should be maintained for scrolled search
35
- # @option arguments [String] :search_type Search operation type (options: query_then_fetch, query_and_fetch, dfs_query_then_fetch, dfs_query_and_fetch)
21
+ # @option arguments [String] :search_type Search operation type
22
+ # (options: query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch)
23
+
36
24
  # @option arguments [Boolean] :explain Specify whether to return detailed information about score computation as part of a hit
37
25
  # @option arguments [Boolean] :profile Specify whether to profile the query execution
38
26
  # @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
39
27
  # @option arguments [Boolean] :rest_total_hits_as_int Indicates whether hits.total should be rendered as an integer or an object in the rest search response
40
- # @option arguments [Boolean] :ccs_minimize_roundtrips Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
28
+
29
+ # @option arguments [Hash] :body The search definition template and its params (*Required*)
30
+ #
31
+ # *Deprecation notice*:
32
+ # Specifying types in urls has been deprecated
33
+ # Deprecated since version 7.0.0
41
34
  #
42
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html
43
35
  #
44
- def search_template(arguments={})
45
- method = HTTP_GET
46
- path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_search/template' )
36
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-template.html
37
+ #
38
+ def search_template(arguments = {})
39
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
40
+
41
+ arguments = arguments.clone
42
+
43
+ _index = arguments.delete(:index)
44
+
45
+ _type = arguments.delete(:type)
46
+
47
+ method = Elasticsearch::API::HTTP_GET
48
+ path = if _index && _type
49
+ "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_search/template"
50
+ elsif _index
51
+ "#{Utils.__listify(_index)}/_search/template"
52
+ else
53
+ "_search/template"
54
+ end
47
55
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
48
- body = arguments[:body]
49
56
 
57
+ body = arguments[:body]
50
58
  perform_request(method, path, params, body).body
51
59
  end
52
60
 
53
61
  # Register this action with its valid params when the module is loaded.
54
62
  #
55
- # @since 6.1.1
63
+ # @since 6.2.0
56
64
  ParamsRegistry.register(:search_template, [
57
- :ignore_unavailable,
58
- :ignore_throttled,
59
- :allow_no_indices,
60
- :expand_wildcards,
61
- :preference,
62
- :routing,
63
- :scroll,
64
- :search_type,
65
- :explain,
66
- :profile,
67
- :typed_keys,
68
- :rest_total_hits_as_int,
69
- :ccs_minimize_roundtrips ].freeze)
65
+ :ignore_unavailable,
66
+ :ignore_throttled,
67
+ :allow_no_indices,
68
+ :expand_wildcards,
69
+ :preference,
70
+ :routing,
71
+ :scroll,
72
+ :search_type,
73
+ :explain,
74
+ :profile,
75
+ :typed_keys,
76
+ :rest_total_hits_as_int
77
+ ].freeze)
78
+ end
70
79
  end
71
- end
72
80
  end
@@ -0,0 +1,44 @@
1
+ # Licensed to Elasticsearch B.V under one or more agreements.
2
+ # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
+ # See the LICENSE file in the project root for more information
4
+
5
+ module Elasticsearch
6
+ module API
7
+ module Snapshot
8
+ module Actions
9
+ # Removes stale data from repository.
10
+ #
11
+ # @option arguments [String] :repository A repository name
12
+ # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
13
+ # @option arguments [Time] :timeout Explicit operation timeout
14
+
15
+ # @option arguments [Hash] :body TODO: Description
16
+ #
17
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
18
+ #
19
+ def cleanup_repository(arguments = {})
20
+ raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
21
+
22
+ arguments = arguments.clone
23
+
24
+ _repository = arguments.delete(:repository)
25
+
26
+ method = Elasticsearch::API::HTTP_POST
27
+ path = "_snapshot/#{Utils.__listify(_repository)}/_cleanup"
28
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
29
+
30
+ body = arguments[:body]
31
+ perform_request(method, path, params, body).body
32
+ end
33
+
34
+ # Register this action with its valid params when the module is loaded.
35
+ #
36
+ # @since 6.2.0
37
+ ParamsRegistry.register(:cleanup_repository, [
38
+ :master_timeout,
39
+ :timeout
40
+ ].freeze)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -6,50 +6,43 @@ module Elasticsearch
6
6
  module API
7
7
  module Snapshot
8
8
  module Actions
9
-
10
- # Create a new snapshot in the repository
11
- #
12
- # @example Create a snapshot of the whole cluster in the `my-backups` repository
13
- #
14
- # client.snapshot.create repository: 'my-backups', snapshot: 'snapshot-1'
9
+ # Creates a snapshot in a repository.
15
10
  #
16
- # @example Create a snapshot for specific indices in the `my-backups` repository
17
- #
18
- # client.snapshot.create repository: 'my-backups',
19
- # snapshot: 'snapshot-2',
20
- # body: { indices: 'foo,bar', ignore_unavailable: true }
21
- #
22
- # @option arguments [String] :repository A repository name (*Required*)
23
- # @option arguments [String] :snapshot A snapshot name (*Required*)
24
- # @option arguments [Hash] :body The snapshot definition
11
+ # @option arguments [String] :repository A repository name
12
+ # @option arguments [String] :snapshot A snapshot name
25
13
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
26
- # @option arguments [Boolean] :wait_for_completion Whether the request should block and wait until
27
- # the operation has completed
14
+ # @option arguments [Boolean] :wait_for_completion Should this request wait until the operation has completed before returning
15
+
16
+ # @option arguments [Hash] :body The snapshot definition
28
17
  #
29
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html#_snapshot
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/modules-snapshots.html
30
19
  #
31
- def create(arguments={})
20
+ def create(arguments = {})
32
21
  raise ArgumentError, "Required argument 'repository' missing" unless arguments[:repository]
33
- raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
34
- repository = arguments.delete(:repository)
35
- snapshot = arguments.delete(:snapshot)
22
+ raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
23
+
24
+ arguments = arguments.clone
36
25
 
37
- method = HTTP_PUT
38
- path = Utils.__pathify( '_snapshot', Utils.__escape(repository), Utils.__escape(snapshot) )
26
+ _repository = arguments.delete(:repository)
39
27
 
28
+ _snapshot = arguments.delete(:snapshot)
29
+
30
+ method = Elasticsearch::API::HTTP_PUT
31
+ path = "_snapshot/#{Utils.__listify(_repository)}/#{Utils.__listify(_snapshot)}"
40
32
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
41
- body = arguments[:body]
42
33
 
34
+ body = arguments[:body]
43
35
  perform_request(method, path, params, body).body
44
36
  end
45
37
 
46
38
  # Register this action with its valid params when the module is loaded.
47
39
  #
48
- # @since 6.1.1
40
+ # @since 6.2.0
49
41
  ParamsRegistry.register(:create, [
50
- :master_timeout,
51
- :wait_for_completion ].freeze)
42
+ :master_timeout,
43
+ :wait_for_completion
44
+ ].freeze)
45
+ end
52
46
  end
53
- end
54
47
  end
55
48
  end
@@ -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
- # client.snapshot.create_repository repository: 'my-backups',
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/master/modules-snapshots.html#_repositories
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
- method = HTTP_PUT
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.1.1
38
+ # @since 6.2.0
45
39
  ParamsRegistry.register(:create_repository, [
46
- :master_timeout,
47
- :timeout,
48
- :verify ].freeze)
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 (*Required*)
19
- # @option arguments [String] :snapshot A snapshot name (*Required*)
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
- # @option arguments [Number,List] :ignore The list of HTTP errors to ignore
14
+
22
15
  #
23
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
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" unless arguments[:snapshot]
28
- repository = arguments.delete(:repository)
29
- snapshot = arguments.delete(:snapshot)
20
+ raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
21
+
22
+ arguments = arguments.clone
30
23
 
31
- method = HTTP_DELETE
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.1.1
47
- ParamsRegistry.register(:delete, [ :master_timeout ].freeze)
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 (*Required*)
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
- # @option arguments [Number,List] :ignore The list of HTTP errors to ignore
14
+
20
15
  #
21
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html
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
- method = HTTP_DELETE
28
- path = Utils.__pathify( '_snapshot', Utils.__listify(repository) )
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.1.1
39
+ # @since 6.2.0
43
40
  ParamsRegistry.register(:delete_repository, [
44
- :master_timeout,
45
- :timeout ].freeze)
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
- # client.snapshot.get repository: 'my-backup', snapshot: '_all'
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/master/modules-snapshots.html
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" unless arguments[:snapshot]
36
- repository = arguments.delete(:repository)
37
- snapshot = arguments.delete(:snapshot)
22
+ raise ArgumentError, "Required argument 'snapshot' missing" unless arguments[:snapshot]
23
+
24
+ arguments = arguments.clone
38
25
 
39
- method = HTTP_GET
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.1.1
44
+ # @since 6.2.0
55
45
  ParamsRegistry.register(:get, [
56
- :ignore_unavailable,
57
- :master_timeout,
58
- :verbose ].freeze)
46
+ :master_timeout,
47
+ :ignore_unavailable,
48
+ :verbose
49
+ ].freeze)
50
+ end
59
51
  end
60
- end
61
52
  end
62
53
  end