elastomer-client 3.0.1 → 3.1.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +4 -0
  4. data/lib/elastomer/client/bulk.rb +1 -1
  5. data/lib/elastomer/client/cluster.rb +10 -22
  6. data/lib/elastomer/client/docs.rb +46 -55
  7. data/lib/elastomer/client/index.rb +33 -33
  8. data/lib/elastomer/client/multi_percolate.rb +9 -9
  9. data/lib/elastomer/client/multi_search.rb +5 -5
  10. data/lib/elastomer/client/native_delete_by_query.rb +2 -22
  11. data/lib/elastomer/client/nodes.rb +8 -22
  12. data/lib/elastomer/client/percolator.rb +5 -5
  13. data/lib/elastomer/client/repository.rb +7 -7
  14. data/lib/elastomer/client/rest_api_spec/api_spec.rb +119 -0
  15. data/lib/elastomer/client/rest_api_spec/api_spec_v2_3.rb +2232 -0
  16. data/lib/elastomer/client/rest_api_spec/api_spec_v2_4.rb +2250 -0
  17. data/lib/elastomer/client/rest_api_spec/api_spec_v5_6.rb +2491 -0
  18. data/lib/elastomer/client/rest_api_spec/rest_api.rb +59 -0
  19. data/lib/elastomer/client/rest_api_spec.rb +44 -0
  20. data/lib/elastomer/client/scroller.rb +10 -10
  21. data/lib/elastomer/client/snapshot.rb +7 -7
  22. data/lib/elastomer/client/tasks.rb +45 -51
  23. data/lib/elastomer/client/template.rb +8 -8
  24. data/lib/elastomer/client/warmer.rb +11 -4
  25. data/lib/elastomer/client.rb +31 -7
  26. data/lib/elastomer/version.rb +1 -1
  27. data/lib/elastomer/version_support.rb +35 -46
  28. data/script/generate-rest-api-spec +152 -0
  29. data/test/client/rest_api_spec/api_spec_test.rb +55 -0
  30. data/test/client/rest_api_spec/rest_api_test.rb +96 -0
  31. data/test/client/stubbed_client_test.rb +1 -19
  32. data/test/middleware/opaque_id_test.rb +1 -3
  33. data/test/notifications_test.rb +0 -5
  34. data/test/test_helper.rb +5 -4
  35. data/test/version_support_test.rb +3 -21
  36. metadata +13 -2
@@ -40,7 +40,7 @@ module Elastomer
40
40
  #
41
41
  # Returns true if the index (or type) exists
42
42
  def exists?( params = {} )
43
- response = client.head "/{index}{/type}", update_params(params, :action => "index.exists")
43
+ response = client.head "/{index}{/type}", update_params(params, action: "index.exists", rest_api: "indices.exists")
44
44
  response.success?
45
45
  end
46
46
  alias_method :exist?, :exists?
@@ -54,7 +54,7 @@ module Elastomer
54
54
  #
55
55
  # Returns the response body as a Hash
56
56
  def create( body, params = {} )
57
- response = client.put "/{index}", update_params(params, :body => body, :action => "index.create")
57
+ response = client.put "/{index}", update_params(params, body: body, action: "index.create", rest_api: "indices.create")
58
58
  response.body
59
59
  end
60
60
 
@@ -66,7 +66,7 @@ module Elastomer
66
66
  #
67
67
  # Returns the response body as a Hash
68
68
  def delete( params = {} )
69
- response = client.delete "/{index}", update_params(params, :action => "index.delete")
69
+ response = client.delete "/{index}", update_params(params, action: "index.delete", rest_api: "indices.delete")
70
70
  response.body
71
71
  end
72
72
 
@@ -78,7 +78,7 @@ module Elastomer
78
78
  #
79
79
  # Returns the response body as a Hash
80
80
  def open( params = {} )
81
- response = client.post "/{index}/_open", update_params(params, :action => "index.open")
81
+ response = client.post "/{index}/_open", update_params(params, action: "index.open", rest_api: "indices.open")
82
82
  response.body
83
83
  end
84
84
 
@@ -90,7 +90,7 @@ module Elastomer
90
90
  #
91
91
  # Returns the response body as a Hash
92
92
  def close( params = {} )
93
- response = client.post "/{index}/_close", update_params(params, :action => "index.close")
93
+ response = client.post "/{index}/_close", update_params(params, action: "index.close", rest_api: "indices.close")
94
94
  response.body
95
95
  end
96
96
 
@@ -102,7 +102,7 @@ module Elastomer
102
102
  #
103
103
  # Returns the response body as a Hash
104
104
  def get_settings( params = {} )
105
- response = client.get "{/index}/_settings", update_params(params, :action => "index.get_settings")
105
+ response = client.get "{/index}/_settings", update_params(params, action: "index.get_settings", rest_api: "indices.get_settings")
106
106
  response.body
107
107
  end
108
108
  alias_method :settings, :get_settings
@@ -116,7 +116,7 @@ module Elastomer
116
116
  #
117
117
  # Returns the response body as a Hash
118
118
  def update_settings( body, params = {} )
119
- response = client.put "{/index}/_settings", update_params(params, :body => body, :action => "index.update_settings")
119
+ response = client.put "{/index}/_settings", update_params(params, body: body, action: "index.update_settings", rest_api: "indices.put_settings")
120
120
  response.body
121
121
  end
122
122
 
@@ -130,7 +130,7 @@ module Elastomer
130
130
  #
131
131
  # Returns the response body as a Hash
132
132
  def get_mapping( params = {} )
133
- response = client.get "/{index}/_mapping{/type}", update_params(params, :action => "index.get_mapping")
133
+ response = client.get "/{index}/_mapping{/type}", update_params(params, action: "index.get_mapping", rest_api: "indices.get_mapping")
134
134
  response.body
135
135
  end
136
136
  alias_method :mapping, :get_mapping
@@ -145,7 +145,7 @@ module Elastomer
145
145
  #
146
146
  # Returns the response body as a Hash
147
147
  def update_mapping( type, body, params = {} )
148
- response = client.put "/{index}/_mapping/{type}", update_params(params, :body => body, :type => type, :action => "index.update_mapping")
148
+ response = client.put "/{index}/_mapping/{type}", update_params(params, body: body, type: type, action: "index.update_mapping", rest_api: "indices.put_mapping")
149
149
  response.body
150
150
  end
151
151
  alias_method :put_mapping, :update_mapping
@@ -158,7 +158,7 @@ module Elastomer
158
158
  #
159
159
  # Returns the response body as a Hash
160
160
  def get_aliases( params = {} )
161
- response = client.get "/{index}/_aliases", update_params(:action => "index.get_aliases")
161
+ response = client.get "/{index}/_alias", update_params(action: "index.get_aliases", rest_api: "indices.get_alias")
162
162
  response.body
163
163
  end
164
164
  alias_method :aliases, :get_aliases
@@ -179,7 +179,7 @@ module Elastomer
179
179
  #
180
180
  # Returns the response body as a Hash
181
181
  def get_alias( name, params = {} )
182
- response = client.get "/{index}/_alias/{name}", update_params(params, :name => name, :action => "index.get_alias")
182
+ response = client.get "/{index}/_alias/{name}", update_params(params, name: name, action: "index.get_alias", rest_api: "indices.get_alias")
183
183
  response.body
184
184
  end
185
185
 
@@ -192,13 +192,13 @@ module Elastomer
192
192
  #
193
193
  # Examples
194
194
  #
195
- # index.add_alias("foo", :routing => "foo")
195
+ # index.add_alias("foo", routing: "foo")
196
196
  #
197
197
  # See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
198
198
  #
199
199
  # Returns the response body as a Hash
200
200
  def add_alias( name, params = {} )
201
- response = client.put "/{index}/_alias/{name}", update_params(params, :name => name, :action => "index.add_alias")
201
+ response = client.put "/{index}/_alias/{name}", update_params(params, name: name, action: "index.add_alias", rest_api: "indices.put_alias")
202
202
  response.body
203
203
  end
204
204
 
@@ -216,7 +216,7 @@ module Elastomer
216
216
  #
217
217
  # Returns the response body as a Hash
218
218
  def delete_alias( name, params = {} )
219
- response = client.delete "/{index}/_alias/{name}", update_params(params, :name => name, :action => "index.delete_alias")
219
+ response = client.delete "/{index}/_alias/{name}", update_params(params, name: name, action: "index.delete_alias", rest_api: "indices.delete_alias")
220
220
  response.body
221
221
  end
222
222
 
@@ -231,7 +231,7 @@ module Elastomer
231
231
  # Returns the response body as a Hash
232
232
  def analyze( text, params = {} )
233
233
  body = text.is_a?(Hash) ? text : {text: text.to_s}
234
- response = client.get "{/index}/_analyze", update_params(params, body: body, action: "index.analyze")
234
+ response = client.get "{/index}/_analyze", update_params(params, body: body, action: "index.analyze", rest_api: "indices.analyze")
235
235
  response.body
236
236
  end
237
237
 
@@ -245,7 +245,7 @@ module Elastomer
245
245
  #
246
246
  # Returns the response body as a Hash
247
247
  def refresh( params = {} )
248
- response = client.post "{/index}/_refresh", update_params(params, :action => "index.refresh")
248
+ response = client.post "{/index}/_refresh", update_params(params, action: "index.refresh", rest_api: "indices.refresh")
249
249
  response.body
250
250
  end
251
251
 
@@ -258,7 +258,7 @@ module Elastomer
258
258
  #
259
259
  # Returns the response body as a Hash
260
260
  def flush( params = {} )
261
- response = client.post "{/index}/_flush", update_params(params, :action => "index.flush")
261
+ response = client.post "{/index}/_flush", update_params(params, action: "index.flush", rest_api: "indices.flush")
262
262
  response.body
263
263
  end
264
264
 
@@ -272,7 +272,7 @@ module Elastomer
272
272
  #
273
273
  # Returns the response body as a Hash
274
274
  def forcemerge( params = {} )
275
- response = client.post "{/index}/_forcemerge", update_params(params, :action => "index.forcemerge")
275
+ response = client.post "{/index}/_forcemerge", update_params(params, action: "index.forcemerge", rest_api: "indices.forcemerge")
276
276
  response.body
277
277
  end
278
278
  # DEPRECATED: ES 5.X has removed the `/_optimize` endpoint.
@@ -287,7 +287,7 @@ module Elastomer
287
287
  #
288
288
  # Returns the response body as a Hash
289
289
  def recovery( params = {} )
290
- response = client.get "{/index}/_recovery", update_params(params, :action => "index.recovery")
290
+ response = client.get "{/index}/_recovery", update_params(params, action: "index.recovery", rest_api: "indices.recovery")
291
291
  response.body
292
292
  end
293
293
 
@@ -301,7 +301,7 @@ module Elastomer
301
301
  #
302
302
  # Returns the response body as a Hash
303
303
  def clear_cache( params = {} )
304
- response = client.post "{/index}/_cache/clear", update_params(params, :action => "index.clear_cache")
304
+ response = client.post "{/index}/_cache/clear", update_params(params, action: "index.clear_cache", rest_api: "indices.clear_cache")
305
305
  response.body
306
306
  end
307
307
 
@@ -320,7 +320,7 @@ module Elastomer
320
320
  #
321
321
  # Returns the response body as a Hash
322
322
  def stats( params = {} )
323
- response = client.get "{/index}/_stats{/stats}", update_params(params, :action => "index.stats")
323
+ response = client.get "{/index}/_stats{/stats}", update_params(params, action: "index.stats", rest_api: "indices.stats")
324
324
  response.body
325
325
  end
326
326
 
@@ -333,7 +333,7 @@ module Elastomer
333
333
  #
334
334
  # Returns the response body as a Hash
335
335
  def segments( params = {} )
336
- response = client.get "{/index}/_segments", update_params(params, :action => "index.segments")
336
+ response = client.get "{/index}/_segments", update_params(params, action: "index.segments", rest_api: "indices.segments")
337
337
  response.body
338
338
  end
339
339
 
@@ -358,7 +358,7 @@ module Elastomer
358
358
  #
359
359
  # Returns the response body as a Hash
360
360
  def suggest(query, params = {})
361
- response = client.post "{/index}/_suggest", update_params(params, :body => query, :action => "index.suggest")
361
+ response = client.post "{/index}/_suggest", update_params(params, body: query, action: "index.suggest", rest_api: "suggest")
362
362
  response.body
363
363
  end
364
364
 
@@ -387,7 +387,7 @@ module Elastomer
387
387
  def bulk( params = {}, &block )
388
388
  raise "a block is required" if block.nil?
389
389
 
390
- params = {:index => self.name}.merge params
390
+ params = {index: self.name}.merge params
391
391
  client.bulk params, &block
392
392
  end
393
393
 
@@ -413,7 +413,7 @@ module Elastomer
413
413
  #
414
414
  # Returns a new Scroller instance
415
415
  def scroll( query, opts = {} )
416
- opts = {:index => name}.merge opts
416
+ opts = {index: name}.merge opts
417
417
  client.scroll query, opts
418
418
  end
419
419
 
@@ -442,7 +442,7 @@ module Elastomer
442
442
  #
443
443
  # Returns a new Scroller instance
444
444
  def scan( query, opts = {} )
445
- opts = {:index => name}.merge opts
445
+ opts = {index: name}.merge opts
446
446
  client.scan query, opts
447
447
  end
448
448
 
@@ -464,8 +464,8 @@ module Elastomer
464
464
  # Examples
465
465
  #
466
466
  # index.multi_search do |m|
467
- # m.search({:query => {:match_all => {}}, :size => 0)
468
- # m.search({:query => {:field => {"author" => "grantr"}}}, :type => 'tweet')
467
+ # m.search({query: {match_all: {}}, size: 0)
468
+ # m.search({query: {field: {"author" => "grantr"}}}, type: 'tweet')
469
469
  # ...
470
470
  # end
471
471
  #
@@ -475,7 +475,7 @@ module Elastomer
475
475
  def multi_search( params = {}, &block )
476
476
  raise "a block is required" if block.nil?
477
477
 
478
- params = {:index => self.name}.merge params
478
+ params = {index: self.name}.merge params
479
479
  client.multi_search params, &block
480
480
  end
481
481
 
@@ -493,8 +493,8 @@ module Elastomer
493
493
  #
494
494
  # # block form
495
495
  # multi_percolate do |m|
496
- # m.percolate({ :author => "pea53" }, { :type => 'default-type' })
497
- # m.count({ :author => "pea53" }, { :type => 'type2' })
496
+ # m.percolate({ author: "pea53" }, { type: 'default-type' })
497
+ # m.count({ author: "pea53" }, { type: 'type2' })
498
498
  # ...
499
499
  # end
500
500
  #
@@ -515,7 +515,7 @@ module Elastomer
515
515
  # warmer_name - The name of the warmer to operate on.
516
516
  #
517
517
  # Examples
518
- # index.warmer('warmer1').create(:query => {:match_all => {}})
518
+ # index.warmer('warmer1').create(query: {match_all: {}})
519
519
  # index.warmer('warmer1').get
520
520
  # index.warmer('warmer1').delete
521
521
  #
@@ -587,7 +587,7 @@ module Elastomer
587
587
 
588
588
  # Internal: Returns a Hash containing default parameters.
589
589
  def defaults
590
- { :index => name }
590
+ { index: name }
591
591
  end
592
592
 
593
593
  end
@@ -21,12 +21,12 @@ module Elastomer
21
21
  # multi_percolate(request_body)
22
22
  #
23
23
  # # index in URI
24
- # multi_percolate(request_body, :index => 'default-index')
24
+ # multi_percolate(request_body, index: 'default-index')
25
25
  #
26
26
  # # block form
27
- # multi_percolate(:index => 'default-index') do |m|
28
- # m.percolate({ :author => "pea53" }, { :type => 'default-type' })
29
- # m.count({ :author => "pea53" }, { :type => 'type2' })
27
+ # multi_percolate(index: 'default-index') do |m|
28
+ # m.percolate({ author: "pea53" }, { type: 'default-type' })
29
+ # m.count({ author: "pea53" }, { type: 'type2' })
30
30
  # ...
31
31
  # end
32
32
  #
@@ -40,7 +40,7 @@ module Elastomer
40
40
  raise "multi_percolate request body cannot be nil" if body.nil?
41
41
  params ||= {}
42
42
 
43
- response = self.post "{/index}{/type}/_mpercolate", params.merge(:body => body)
43
+ response = self.post "{/index}{/type}/_mpercolate", params.merge(body: body, action: "mpercolate", rest_api: "mpercolate")
44
44
  response.body
45
45
  end
46
46
  end
@@ -80,8 +80,8 @@ module Elastomer
80
80
  #
81
81
  # Returns this MultiPercolate instance.
82
82
  def percolate(doc, header = {})
83
- add_to_actions(:percolate => @params.merge(header))
84
- add_to_actions(:doc => doc)
83
+ add_to_actions(percolate: @params.merge(header))
84
+ add_to_actions(doc: doc)
85
85
  end
86
86
 
87
87
  # Add a percolate acount action to the multi percolate request. This
@@ -93,8 +93,8 @@ module Elastomer
93
93
  #
94
94
  # Returns this MultiPercolate instance.
95
95
  def count(doc, header = {})
96
- add_to_actions(:count => @params.merge(header))
97
- add_to_actions(:doc => doc)
96
+ add_to_actions(count: @params.merge(header))
97
+ add_to_actions(doc: doc)
98
98
  end
99
99
 
100
100
  # Execute the multi_percolate call with the accumulated percolate actions.
@@ -21,12 +21,12 @@ module Elastomer
21
21
  # multi_search(request_body)
22
22
  #
23
23
  # # index in URI
24
- # multi_search(request_body, :index => 'default-index')
24
+ # multi_search(request_body, index: 'default-index')
25
25
  #
26
26
  # # block form
27
- # multi_search(:index => 'default-index') do |m|
28
- # m.search({:query => {:match_all => {}}, :size => 0)
29
- # m.search({:query => {:field => {"foo" => "bar"}}}, :type => 'default-type')
27
+ # multi_search(index: 'default-index') do |m|
28
+ # m.search({query: {match_all: {}}, size: 0)
29
+ # m.search({query: {field: {"foo" => "bar"}}}, type: 'default-type')
30
30
  # ...
31
31
  # end
32
32
  #
@@ -40,7 +40,7 @@ module Elastomer
40
40
  raise "multi_search request body cannot be nil" if body.nil?
41
41
  params ||= {}
42
42
 
43
- response = self.post "{/index}{/type}/_msearch", params.merge(:body => body)
43
+ response = self.post "{/index}{/type}/_msearch", params.merge(body: body, action: "msearch", rest_api: "msearch")
44
44
  response.body
45
45
  end
46
46
  end
@@ -8,7 +8,7 @@ module Elastomer
8
8
  # Examples
9
9
  #
10
10
  # # request body query
11
- # native_delete_by_query({:query => {:match_all => {}}}, :type => 'tweet')
11
+ # native_delete_by_query({query: {match_all: {}}}, type: 'tweet')
12
12
  #
13
13
  # See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-delete-by-query.html
14
14
  #
@@ -20,39 +20,19 @@ module Elastomer
20
20
  class NativeDeleteByQuery
21
21
  attr_reader :client, :query, :parameters
22
22
 
23
- PARAMETERS = %i[
24
- conflicts
25
- index
26
- q
27
- refresh
28
- routing
29
- scroll_size
30
- timeout
31
- type
32
- wait_for_active_shards
33
- wait_for_completion
34
- ].to_set.freeze
35
-
36
23
  def initialize(client, query, parameters)
37
24
  unless client.version_support.native_delete_by_query?
38
25
  raise IncompatibleVersionException, "Elasticsearch '#{client.version}' does not support _delete_by_query"
39
26
  end
40
27
 
41
- parameters.keys.each do |key|
42
- unless PARAMETERS.include?(key) || PARAMETERS.include?(key.to_sym)
43
- raise IllegalArgument, "'#{key}' is not a valid _delete_by_query parameter"
44
- end
45
- end
46
-
47
28
  @client = client
48
29
  @query = query
49
30
  @parameters = parameters
50
-
51
31
  end
52
32
 
53
33
  def execute
54
34
  # TODO: Require index parameter. type is optional.
55
- response = client.post("/{index}{/type}/_delete_by_query", parameters.merge(body: query))
35
+ response = client.post("/{index}{/type}/_delete_by_query", parameters.merge(body: query, action: "delete_by_query", rest_api: "delete_by_query"))
56
36
  response.body
57
37
  end
58
38
  end
@@ -41,15 +41,15 @@ module Elastomer
41
41
  #
42
42
  # Examples
43
43
  #
44
- # info(:info => "_all")
45
- # info(:info => "os")
46
- # info(:info => %w[os jvm process])
44
+ # info(info: "_all")
45
+ # info(info: "os")
46
+ # info(info: %w[os jvm process])
47
47
  #
48
48
  # See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-info.html
49
49
  #
50
50
  # Returns the response as a Hash
51
51
  def info( params = {} )
52
- response = client.get "/_nodes{/node_id}{/info}", update_params(params, :action => "nodes.info")
52
+ response = client.get "/_nodes{/node_id}{/info}", update_params(params, action: "nodes.info", rest_api: "nodes.info")
53
53
  response.body
54
54
  end
55
55
 
@@ -62,14 +62,14 @@ module Elastomer
62
62
  #
63
63
  # Examples
64
64
  #
65
- # stats(:stats => "thread_pool")
66
- # stats(:stats => %w[os process])
65
+ # stats(stats: "thread_pool")
66
+ # stats(stats: %w[os process])
67
67
  #
68
68
  # See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html
69
69
  #
70
70
  # Returns the response as a Hash
71
71
  def stats( params = {} )
72
- response = client.get "/_nodes{/node_id}/stats{/stats}", update_params(params, :action => "nodes.stats")
72
+ response = client.get "/_nodes{/node_id}/stats{/stats}", update_params(params, action: "nodes.stats", rest_api: "nodes.stats")
73
73
  response.body
74
74
  end
75
75
 
@@ -87,21 +87,7 @@ module Elastomer
87
87
  #
88
88
  # Returns the response as a String
89
89
  def hot_threads( params = {} )
90
- response = client.get "/_nodes{/node_id}/hot_threads", update_params(params, :action => "nodes.hot_threads")
91
- response.body
92
- end
93
-
94
- # Shutdown one or more nodes in the cluster. There is also a
95
- # Cluster#shutdown command for shutting down the entire cluseter.
96
- #
97
- # params - Parameters Hash
98
- # :node_id - a single node ID or Array of node IDs
99
- #
100
- # See https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-shutdown.html
101
- #
102
- # Returns the response as a Hash
103
- def shutdown( params = {} )
104
- response = client.post "/_cluster/nodes{/node_id}/_shutdown", update_params(params, :action => "nodes.shutdown")
90
+ response = client.get "/_nodes{/node_id}/hot_threads", update_params(params, action: "nodes.hot_threads", rest_api: "nodes.hot_threads")
105
91
  response.body
106
92
  end
107
93
 
@@ -24,11 +24,11 @@ module Elastomer
24
24
  # Examples
25
25
  #
26
26
  # percolator = $client.index("default-index").percolator "1"
27
- # percolator.create :query => { :match_all => { } }
27
+ # percolator.create query: { match_all: { } }
28
28
  #
29
29
  # Returns the response body as a Hash
30
30
  def create(body, params = {})
31
- response = client.put("/{index}/#{@percolator_type}/{id}", defaults.merge(params.merge(:body => body, :action => "percolator.create")))
31
+ response = client.put("/{index}/#{@percolator_type}/{id}", defaults.merge(params.merge(body: body, action: "percolator.create")))
32
32
  response.body
33
33
  end
34
34
 
@@ -41,7 +41,7 @@ module Elastomer
41
41
  #
42
42
  # Returns the response body as a Hash
43
43
  def get(params = {})
44
- response = client.get("/{index}/#{@percolator_type}/{id}", defaults.merge(params.merge(:action => "percolator.get")))
44
+ response = client.get("/{index}/#{@percolator_type}/{id}", defaults.merge(params.merge(action: "percolator.get")))
45
45
  response.body
46
46
  end
47
47
 
@@ -54,7 +54,7 @@ module Elastomer
54
54
  #
55
55
  # Returns the response body as a Hash
56
56
  def delete(params = {})
57
- response = client.delete("/{index}/#{@percolator_type}/{id}", defaults.merge(params.merge(:action => "percolator.delete")))
57
+ response = client.delete("/{index}/#{@percolator_type}/{id}", defaults.merge(params.merge(action: "percolator.delete")))
58
58
  response.body
59
59
  end
60
60
 
@@ -72,7 +72,7 @@ module Elastomer
72
72
 
73
73
  # Internal: Returns a Hash containing default parameters.
74
74
  def defaults
75
- {:index => index_name, :id => id}
75
+ {index: index_name, id: id}
76
76
  end
77
77
 
78
78
  end # Percolator
@@ -26,7 +26,7 @@ module Elastomer
26
26
  #
27
27
  # Returns true if the repository exists
28
28
  def exists?(params = {})
29
- response = client.get "/_snapshot{/repository}", update_params(params, :action => "repository.exists")
29
+ response = client.get "/_snapshot{/repository}", update_params(params, action: "repository.exists", rest_api: "snapshot.get_repository")
30
30
  response.success?
31
31
  rescue Elastomer::Client::Error => err
32
32
  if err.error && err.error.dig("root_cause", 0, "type") == "repository_missing_exception"
@@ -45,7 +45,7 @@ module Elastomer
45
45
  #
46
46
  # Returns the response body as a Hash
47
47
  def create(body, params = {})
48
- response = client.put "/_snapshot/{repository}", update_params(params, :body => body, :action => "repository.create")
48
+ response = client.put "/_snapshot/{repository}", update_params(params, body: body, action: "repository.create", rest_api: "snapshot.create_repository")
49
49
  response.body
50
50
  end
51
51
 
@@ -56,7 +56,7 @@ module Elastomer
56
56
  #
57
57
  # Returns the response body as a Hash
58
58
  def get(params = {})
59
- response = client.get "/_snapshot{/repository}", update_params(params, :action => "repository.get")
59
+ response = client.get "/_snapshot{/repository}", update_params(params, action: "repository.get", rest_api: "snapshot.get_repository")
60
60
  response.body
61
61
  end
62
62
 
@@ -67,7 +67,7 @@ module Elastomer
67
67
  #
68
68
  # Returns the response body as a Hash
69
69
  def status(params = {})
70
- response = client.get "/_snapshot{/repository}/_status", update_params(params, :action => "repository.status")
70
+ response = client.get "/_snapshot{/repository}/_status", update_params(params, action: "repository.status", rest_api: "snapshot.status")
71
71
  response.body
72
72
  end
73
73
 
@@ -79,7 +79,7 @@ module Elastomer
79
79
  #
80
80
  # Returns the response body as a Hash
81
81
  def update(body, params = {})
82
- response = client.put "/_snapshot/{repository}", update_params(params, :body => body, :action => "repository.update")
82
+ response = client.put "/_snapshot/{repository}", update_params(params, body: body, action: "repository.update", rest_api: "snapshot.create_repository")
83
83
  response.body
84
84
  end
85
85
 
@@ -90,7 +90,7 @@ module Elastomer
90
90
  #
91
91
  # Returns the response body as a Hash
92
92
  def delete(params = {})
93
- response = client.delete "/_snapshot/{repository}", update_params(params, :action => "repository.delete")
93
+ response = client.delete "/_snapshot/{repository}", update_params(params, action: "repository.delete", rest_api: "snapshot.delete_repository")
94
94
  response.body
95
95
  end
96
96
 
@@ -120,7 +120,7 @@ module Elastomer
120
120
 
121
121
  # Internal: Returns a Hash containing default parameters.
122
122
  def defaults
123
- { :repository => name }
123
+ { repository: name }
124
124
  end
125
125
  end
126
126
  end