elasticsearch-api 5.0.4 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cb2788ca6e0c1ccc1b739be6fb09f755491fb3c
4
- data.tar.gz: 3385a2f367ed82e6c039187c6c02c87ff726f2ad
3
+ metadata.gz: 01b21ab7020339d01811c0e1efdbdc55e9d04133
4
+ data.tar.gz: c27e856e07e1bb3e949b5bf6bb3016a26066fa5b
5
5
  SHA512:
6
- metadata.gz: 9cce9772d2b00e7e3075eb9147875db1ed873e8243cd8daf7cb5075ef9576bdff6f9da9d2fd906b6d5d3da353d812f9a15c6c7e7a9c8e17897b56719316b2882
7
- data.tar.gz: db7a3603ce3702d8cac834774917f1d0b3ddb6960d955ffa50ef584293cc59bc826a6e8f374a5cb15baa38b0bb874acd0edbe2438078137e00f129773f5c59e6
6
+ metadata.gz: 8123766736b77e7d78332094d3fbb17ea84a6b0ded615ecdff059bc4016327f68c8dc1a25c2e02a719b6837793ad30fcbcd190507d9b0998b3b263f3e562e5d1
7
+ data.tar.gz: 0664d1723bf50d485be46d60ff456f80c17fc13d34c14bbe2790ca795882838c874b6d9a3799f8ef446ef9b857ac263dea4cd5de2cc87e387a4f210d8b960b29
@@ -49,7 +49,8 @@ module Elasticsearch
49
49
  Elasticsearch::API::Ingest,
50
50
  Elasticsearch::API::Snapshot,
51
51
  Elasticsearch::API::Tasks,
52
- Elasticsearch::API::Cat
52
+ Elasticsearch::API::Cat,
53
+ Elasticsearch::API::Remote
53
54
  end
54
55
 
55
56
  # The serializer class
@@ -21,6 +21,7 @@ module Elasticsearch
21
21
  # @option arguments [Time] :master_timeout Specify timeout for connection to master
22
22
  # @option arguments [String] :expand_wildcards Whether to expand wildcard expression for inidices
23
23
  # (options: open, closed)
24
+ # @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)
24
25
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
25
26
  # unavailable (missing, closed, etc)
26
27
  #
@@ -37,6 +38,7 @@ module Elasticsearch
37
38
  :local,
38
39
  :master_timeout,
39
40
  :flat_settings,
41
+ :allow_no_indices,
40
42
  :expand_wildcards,
41
43
  :ignore_unavailable ]
42
44
 
@@ -42,7 +42,10 @@ module Elasticsearch
42
42
  # to a numeric field) should be ignored
43
43
  # @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
44
44
  #
45
- # @see http://elasticsearch.org/guide/reference/api/count/
45
+ # @option arguments [Boolean] :terminate_after Specify the maximum count for each shard, upon reaching
46
+ # which the query execution will terminate early.
47
+ #
48
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html
46
49
  #
47
50
  def count(arguments={})
48
51
  valid_params = [
@@ -58,7 +61,8 @@ module Elasticsearch
58
61
  :default_operator,
59
62
  :df,
60
63
  :lenient,
61
- :lowercase_expanded_terms ]
64
+ :lowercase_expanded_terms,
65
+ :terminate_after ]
62
66
 
63
67
  method = HTTP_GET
64
68
  path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_count' )
@@ -27,6 +27,7 @@ module Elasticsearch
27
27
  # @see http://elasticsearch.org/guide/reference/api/index_/
28
28
  #
29
29
  def create(arguments={})
30
+ raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
30
31
  index arguments.update :op_type => 'create'
31
32
  end
32
33
  end
@@ -22,7 +22,7 @@ module Elasticsearch
22
22
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
23
23
  # (default: false)
24
24
  #
25
- # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-types-exists/
25
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html
26
26
  #
27
27
  def exists_type(arguments={})
28
28
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
@@ -36,7 +36,7 @@ module Elasticsearch
36
36
  ]
37
37
 
38
38
  method = HTTP_HEAD
39
- path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type])
39
+ path = Utils.__pathify Utils.__listify(arguments[:index]), '_mapping', Utils.__escape(arguments[:type])
40
40
 
41
41
  params = Utils.__validate_and_extract_params arguments, valid_params
42
42
  body = nil
@@ -13,30 +13,25 @@ module Elasticsearch
13
13
  # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices
14
14
  # @option arguments [Boolean] :force Whether a flush should be forced even if it is not necessarily needed ie.
15
15
  # if no changes will be committed to the index. (Internal)
16
- # @option arguments [Boolean] :full If set to true a new index writer is created and settings that have been
17
- # changed related to the index writer will be refreshed. (Internal)
18
16
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
19
17
  # no concrete indices. (This includes `_all` string or when no
20
18
  # indices have been specified)
21
19
  # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
22
20
  # are open, closed or both. (options: open, closed)
23
- # @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
24
- # `missing` ones (options: none, missing) @until 1.0
21
+ # @option arguments [Boolean] :wait_if_ongoing If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running.
25
22
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
26
23
  # unavailable (missing, closed, etc)
27
- # @option arguments [Boolean] :refresh Refresh the index after performing the operation
28
24
  #
29
25
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-flush/
30
26
  #
31
27
  def flush(arguments={})
32
28
  valid_params = [
33
29
  :force,
34
- :full,
35
- :ignore_indices,
30
+ :wait_if_ongoing,
36
31
  :ignore_unavailable,
37
32
  :allow_no_indices,
38
- :expand_wildcards,
39
- :refresh ]
33
+ :expand_wildcards
34
+ ]
40
35
 
41
36
  method = HTTP_POST
42
37
  path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush'
@@ -16,14 +16,15 @@ module Elasticsearch
16
16
  #
17
17
  # See the {Indices::Actions#update_aliases} for performing operations with index aliases in bulk.
18
18
  #
19
- # @option arguments [String] :index The name of the index with an alias
20
- # @option arguments [String] :name The name of the alias to be created or updated
19
+ # @option arguments [String] :index The name of the index with an alias (*Required*)
20
+ # @option arguments [String] :name The name of the alias to be created or updated (*Required*)
21
21
  # @option arguments [Hash] :body The settings for the alias, such as `routing` or `filter`
22
22
  # @option arguments [Time] :timeout Explicit timestamp for the document
23
23
  #
24
24
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
25
25
  #
26
26
  def put_alias(arguments={})
27
+ raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
27
28
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
28
29
  valid_params = [ :timeout ]
29
30
 
@@ -12,6 +12,7 @@ module Elasticsearch
12
12
  # @option arguments [Number] :wait_for_active_shards Wait until the specified number of shards is active
13
13
  # @option arguments [Time] :timeout Explicit operation timeout
14
14
  # @option arguments [Time] :master_timeout Specify timeout for connection to master
15
+ # @option arguments [Boolean] :dry_run If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false
15
16
  #
16
17
  # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html
17
18
  #
@@ -21,7 +22,8 @@ module Elasticsearch
21
22
  valid_params = [
22
23
  :wait_for_active_shards,
23
24
  :timeout,
24
- :master_timeout ]
25
+ :master_timeout,
26
+ :dry_run ]
25
27
 
26
28
  arguments = arguments.clone
27
29
 
@@ -29,7 +31,7 @@ module Elasticsearch
29
31
  target = arguments.delete(:new_index)
30
32
 
31
33
  method = HTTP_POST
32
- path = Utils.__pathify source, '_rollover', target
34
+ path = Utils.__pathify Utils.__escape(source), '_rollover', Utils.__escape(target)
33
35
  params = Utils.__validate_and_extract_params arguments, valid_params
34
36
  body = arguments[:body]
35
37
 
@@ -59,10 +59,10 @@ module Elasticsearch
59
59
  :types,
60
60
  :timeout ]
61
61
 
62
- method = HTTP_GET
62
+ node_id = arguments.delete(:node_id)
63
63
 
64
64
  path = Utils.__pathify '_nodes',
65
- Utils.__listify(arguments[:node_id]),
65
+ Utils.__listify(node_id),
66
66
  'stats',
67
67
  Utils.__listify(arguments.delete(:metric)),
68
68
  Utils.__listify(arguments.delete(:index_metric))
@@ -75,7 +75,7 @@ module Elasticsearch
75
75
 
76
76
  body = nil
77
77
 
78
- perform_request(method, path, params, body).body
78
+ perform_request(HTTP_GET, path, params, body).body
79
79
  end
80
80
  end
81
81
  end
@@ -7,48 +7,11 @@ module Elasticsearch
7
7
  # Percolator allows you to register queries and then evaluate a document against them:
8
8
  # the IDs of matching queries are returned in the response.
9
9
  #
10
- # @example Register queries named "alert-1" and "alert-2" for the "my-index" index
10
+ # @deprecated The `_percolate` API has been deprecated in favour of a special field mapping and the
11
+ # `percolate` query;
12
+ # see https://www.elastic.co/guide/en/elasticsearch/reference/5.5/breaking_50_percolator.html
11
13
  #
12
- # client.index index: 'my-index',
13
- # type: '.percolator',
14
- # id: 'alert-1',
15
- # body: { query: { query_string: { query: 'foo' } } }
16
- #
17
- # client.index index: 'my-index',
18
- # type: '.percolator',
19
- # id: 'alert-2',
20
- # body: { query: { query_string: { query: 'bar' } } }
21
- #
22
- # @example Evaluate a custom document (passed as `:doc`) against the queries
23
- #
24
- # client.percolate index: 'my-index', type: 'my-type', body: { doc: { title: "Foo" } }
25
- # # => {..., matches: [ {_index: 'my-index', _id: 'alert-1'} ]}
26
- #
27
- # client.percolate index: 'my-index', type: 'my-type', body: { doc: { title: "Foo Bar" } }
28
- # # => {..., matches: [ {_index: 'my-index', _id: 'alert-2'}, {_index: 'my-index', _id: 'alert-1'} ] }
29
- #
30
- # @example Evaluate an existing document against the queries
31
- #
32
- # client.index index: 'my-index', type: 'my-type', id: 123, body: { title: "Foo Bar" }
33
- #
34
- # client.percolate index: 'my-index', type: 'my-type', id: '123'
35
- # # => { ..., matches: [ {_index: 'my-index', _id: 'alert-2'}, { _index: 'my-index', _id: 'alert-1'} ] }
36
- #
37
- # @example Register a query with custom `priority` property
38
- #
39
- # client.index index: 'my-index',
40
- # type: '.percolator',
41
- # id: 'alert-high-1',
42
- # body: { query: { query_string: { query: 'foo' } },
43
- # priority: 'high' }
44
- #
45
- # @example Evaluate a document against "high priority" percolator queries
46
- #
47
- # client.percolate index: 'my-index', type: 'my-type', body: {
48
- # doc: { title: "Foo" },
49
- # filter: { term: { priority: 'high' } }
50
- # }
51
- # # => {..., matches: [ {_index: 'my-index', _id: 'alert-high-1'} ]}
14
+ # See full example for Elasticsearch 5.x and higher in <https://github.com/elastic/elasticsearch-ruby/blob/master/examples/percolator/percolator_alerts.rb>
52
15
  #
53
16
  # @option arguments [String] :index The index of the document being percolated. (*Required*)
54
17
  # @option arguments [String] :type The type of the document being percolated. (*Required*)
@@ -75,6 +38,8 @@ module Elasticsearch
75
38
  # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
76
39
  #
77
40
  def percolate(arguments={})
41
+ Utils.__report_unsupported_method :percolate
42
+
78
43
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
79
44
  raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
80
45
 
@@ -43,9 +43,11 @@ module Elasticsearch
43
43
  # @option arguments [String] :consistency Explicit write consistency setting for the operation
44
44
  # (Options: one, quorum, all)
45
45
  # @option arguments [Boolean] :wait_for_completion Whether the request should block and wait until
46
- # the operation has completed
46
+ # the operation has completed
47
47
  # @option arguments [Float] :requests_per_second The throttling for this request in sub-requests per second.
48
48
  # 0 means set no throttling (default)
49
+ # @option arguments [Integer] :slices The number of slices this request should be divided into.
50
+ # Defaults to 1 meaning the request isn't sliced into sub-requests.
49
51
  #
50
52
  # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html
51
53
  #
@@ -56,7 +58,8 @@ module Elasticsearch
56
58
  :timeout,
57
59
  :consistency,
58
60
  :wait_for_completion,
59
- :requests_per_second ]
61
+ :requests_per_second,
62
+ :slices ]
60
63
  method = 'POST'
61
64
  path = "_reindex"
62
65
  params = Utils.__validate_and_extract_params arguments, valid_params
@@ -0,0 +1,21 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Remote
4
+ module Actions
5
+
6
+ # Returns all of the configured remote cluster information
7
+ #
8
+ # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/remote-info.html
9
+ #
10
+ def info(arguments={})
11
+ method = HTTP_GET
12
+ path = "_remote/info"
13
+ params = {}
14
+ body = nil
15
+
16
+ perform_request(method, path, params, body).body
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -24,10 +24,11 @@ module Elasticsearch
24
24
  :parent_node,
25
25
  :parent_task ]
26
26
 
27
+ arguments = arguments.clone
28
+
27
29
  task_id = arguments.delete(:task_id)
28
30
 
29
31
  method = 'POST'
30
- path = "_tasks"
31
32
  path = Utils.__pathify( '_tasks', Utils.__escape(task_id), '_cancel' )
32
33
  params = Utils.__validate_and_extract_params arguments, valid_params
33
34
  body = nil
@@ -0,0 +1,30 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Tasks
4
+ module Actions
5
+
6
+ # Return information about a specific task
7
+ #
8
+ # @option arguments [String] :task_id Return the task with specified id (node_id:task_number)
9
+ # @option arguments [Boolean] :wait_for_completion Wait for the matching tasks to complete (default: false)
10
+ #
11
+ # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html
12
+ #
13
+ def get(arguments={})
14
+ valid_params = [ :wait_for_completion ]
15
+
16
+ arguments = arguments.clone
17
+
18
+ task_id = arguments.delete(:task_id)
19
+
20
+ method = HTTP_GET
21
+ path = Utils.__pathify '_tasks', Utils.__escape(task_id)
22
+ params = Utils.__validate_and_extract_params arguments, valid_params
23
+ body = nil
24
+
25
+ perform_request(method, path, params, body).body
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -31,10 +31,11 @@ module Elasticsearch
31
31
  :group_by,
32
32
  :wait_for_completion ]
33
33
 
34
+ arguments = arguments.clone
35
+
34
36
  task_id = arguments.delete(:task_id)
35
37
 
36
38
  method = 'GET'
37
- path = "_tasks"
38
39
  path = Utils.__pathify( '_tasks', Utils.__escape(task_id) )
39
40
  params = Utils.__validate_and_extract_params arguments, valid_params
40
41
  body = nil
@@ -0,0 +1,20 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Remote
4
+ module Actions; end
5
+
6
+ # Client for the "remote" namespace (includes the {Remote::Actions} methods)
7
+ #
8
+ class RemoteClient
9
+ include Common::Client, Common::Client::Base, Remote::Actions
10
+ end
11
+
12
+ # Proxy method for {RemoteClient}, available in the receiving object
13
+ #
14
+ def remote
15
+ @remote ||= RemoteClient.new(self)
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -235,10 +235,12 @@ module Elasticsearch
235
235
  end
236
236
 
237
237
  unless messages.empty?
238
+ messages << "Suppress this warning by the `-WO` command line flag."
239
+
238
240
  if STDERR.tty?
239
- STDERR.puts messages.map { |m| "\e[31;1m#{m}\e[0m" }.join("\n")
241
+ Kernel.warn messages.map { |m| "\e[31;1m#{m}\e[0m" }.join("\n")
240
242
  else
241
- STDERR.puts messages.join("\n")
243
+ Kernel.warn messages.join("\n")
242
244
  end
243
245
  end
244
246
  end
@@ -249,12 +251,12 @@ module Elasticsearch
249
251
  message += " in `#{source}`"
250
252
  end
251
253
 
252
- message += ". This method is not supported in the version you're using: #{Elasticsearch::API::VERSION}, and will be removed in the next release."
254
+ message += ". This method is not supported in the version you're using: #{Elasticsearch::API::VERSION}, and will be removed in the next release. Suppress this warning by the `-WO` command line flag."
253
255
 
254
256
  if STDERR.tty?
255
- STDERR.puts "\e[31;1m#{message}\e[0m"
257
+ Kernel.warn "\e[31;1m#{message}\e[0m"
256
258
  else
257
- STDERR.puts message
259
+ Kernel.warn message
258
260
  end
259
261
  end
260
262
 
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "5.0.4"
3
+ VERSION = "5.0.5"
4
4
  end
5
5
  end
@@ -431,18 +431,26 @@ suites.each do |suite|
431
431
 
432
432
  if catch_exception
433
433
  $stderr.puts "CATCH: '#{catch_exception}': #{e.inspect}" if ENV['DEBUG']
434
- case e
435
- when 'missing'
436
- assert_match /\[404\]/, e.message
437
- when 'conflict'
438
- assert_match /\[409\]/, e.message
439
- when 'request'
440
- assert_match /\[500\]/, e.message
441
- when 'param'
442
- raise ArgumentError, "NOT IMPLEMENTED"
443
- when /\/.+\//
444
- assert_match Regexp.new(catch_exception.tr('/', '')), e.message
434
+
435
+ if 'param' == catch_exception
436
+ assert_equal 'ArgumentError', e.class.to_s
437
+ else
438
+ if e.class.to_s =~ /Elasticsearch/
439
+ case catch_exception
440
+ when 'missing'
441
+ assert_match /\[404\]/, e.message
442
+ when 'conflict'
443
+ assert_match /\[409\]/, e.message
444
+ when 'request'
445
+ assert_match /\[4\d\d\]|\[5\d\d\]/, e.message
446
+ when /\/.+\//
447
+ assert_match Regexp.new(catch_exception.tr('/', '')), e.message
448
+ end
449
+ else
450
+ raise e
451
+ end
445
452
  end
453
+
446
454
  else
447
455
  raise e
448
456
  end
@@ -7,16 +7,10 @@ module Elasticsearch
7
7
  context "Creating a document with the #create method" do
8
8
  subject { FakeClient.new }
9
9
 
10
- should "perform the create request" do
11
- subject.expects(:perform_request).with do |method, url, params, body|
12
- assert_equal 'POST', method
13
- assert_equal 'foo/bar', url
14
- assert_equal({:op_type => 'create'}, params)
15
- assert_equal({:foo => 'bar'}, body)
16
- true
17
- end.returns(FakeResponse.new)
18
-
19
- subject.create :index => 'foo', :type => 'bar', :body => {:foo => 'bar'}
10
+ should "require the ID" do
11
+ assert_raise ArgumentError do
12
+ subject.create :index => 'foo', :type => 'bar', :id => nil, :body => {:foo => 'bar'}
13
+ end
20
14
  end
21
15
 
22
16
  should "perform the create request with a specific ID" do
@@ -10,7 +10,7 @@ module Elasticsearch
10
10
  should "perform correct request" do
11
11
  subject.expects(:perform_request).with do |method, url, params, body|
12
12
  assert_equal 'HEAD', method
13
- assert_equal 'foo/bar', url
13
+ assert_equal 'foo/_mapping/bar', url
14
14
  assert_equal Hash.new, params
15
15
  assert_nil body
16
16
  true
@@ -21,7 +21,7 @@ module Elasticsearch
21
21
 
22
22
  should "perform request against multiple indices" do
23
23
  subject.expects(:perform_request).with do |method, url, params, body|
24
- assert_equal 'foo,bar/bam', url
24
+ assert_equal 'foo,bar/_mapping/bam', url
25
25
  true
26
26
  end.returns(FakeResponse.new)
27
27
 
@@ -30,7 +30,7 @@ module Elasticsearch
30
30
 
31
31
  should "URL-escape the parts" do
32
32
  subject.expects(:perform_request).with do |method, url, params, body|
33
- assert_equal 'foo%5Ebar/bar%2Fbam', url
33
+ assert_equal 'foo%5Ebar/_mapping/bar%2Fbam', url
34
34
  true
35
35
  end.returns(FakeResponse.new)
36
36
 
@@ -40,11 +40,11 @@ module Elasticsearch
40
40
  should "pass the URL parameters" do
41
41
  subject.expects(:perform_request).with do |method, url, params, body|
42
42
  assert_equal 'foo/_flush', url
43
- assert_equal true, params[:refresh]
43
+ assert_equal true, params[:ignore_unavailable]
44
44
  true
45
45
  end.returns(FakeResponse.new)
46
46
 
47
- subject.indices.flush :index => 'foo', :refresh => true
47
+ subject.indices.flush :index => 'foo', :ignore_unavailable => true
48
48
  end
49
49
 
50
50
  end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Elasticsearch
4
+ module Test
5
+ class RemoteInfoTest < ::Test::Unit::TestCase
6
+
7
+ context "Remote: Info" do
8
+ subject { FakeClient.new }
9
+
10
+ should "perform correct request" do
11
+ subject.expects(:perform_request).with do |method, url, params, body|
12
+ assert_equal 'GET', method
13
+ assert_equal '_remote/info', url
14
+ assert_equal Hash.new, params
15
+ assert_nil body
16
+ true
17
+ end.returns(FakeResponse.new)
18
+
19
+ subject.remote.info
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Elasticsearch
4
+ module Test
5
+ class TasksGetTest < ::Test::Unit::TestCase
6
+
7
+ context "Tasks: Get" do
8
+ subject { FakeClient.new }
9
+
10
+ should "perform correct request" do
11
+ subject.expects(:perform_request).with do |method, url, params, body|
12
+ assert_equal 'GET', method
13
+ assert_equal '_tasks/foo1', url
14
+ assert_equal Hash.new, params
15
+ assert_nil body
16
+ true
17
+ end.returns(FakeResponse.new)
18
+
19
+ subject.tasks.get :task_id => 'foo1'
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -253,8 +253,8 @@ module Elasticsearch
253
253
  arguments = { :foo => 'bar', :moo => 'bam', :baz => 'qux' }
254
254
  unsupported_params = [:foo, :moo]
255
255
 
256
- STDERR.expects(:puts).with do |message|
257
- assert_equal 2, message.split("\n").size
256
+ Kernel.expects(:warn).with do |message|
257
+ assert_equal 2, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
258
258
  true
259
259
  end
260
260
 
@@ -265,9 +265,9 @@ module Elasticsearch
265
265
  arguments = { :foo => 'bar', :moo => 'bam', :baz => 'qux' }
266
266
  unsupported_params = [ { :foo => { :explanation => 'NOT_SUPPORTED' } } ]
267
267
 
268
- STDERR.expects(:puts).with do |message|
268
+ Kernel.expects(:warn).with do |message|
269
269
  assert_match /NOT_SUPPORTED/, message
270
- assert_equal 1, message.split("\n").size
270
+ assert_equal 1, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
271
271
  true
272
272
  end
273
273
 
@@ -278,9 +278,9 @@ module Elasticsearch
278
278
  arguments = { :foo => 'bar', :moo => 'bam', :baz => 'qux' }
279
279
  unsupported_params = [ { :foo => { :explanation => 'NOT_SUPPORTED'} }, :moo ]
280
280
 
281
- STDERR.expects(:puts).with do |message|
281
+ Kernel.expects(:warn).with do |message|
282
282
  assert_match /NOT_SUPPORTED/, message
283
- assert_equal 2, message.split("\n").size
283
+ assert_equal 2, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
284
284
  true
285
285
  end
286
286
 
@@ -291,7 +291,7 @@ module Elasticsearch
291
291
  arguments = { :moo => 'bam', :baz => 'qux' }
292
292
  unsupported_params = [:foo]
293
293
 
294
- STDERR.expects(:puts).never
294
+ Kernel.expects(:warn).never
295
295
 
296
296
  __report_unsupported_parameters(arguments, unsupported_params)
297
297
  end
@@ -299,7 +299,7 @@ module Elasticsearch
299
299
 
300
300
  context "__report_unsupported_method" do
301
301
  should "print the warning" do
302
- STDERR.expects(:puts).with do |message|
302
+ Kernel.expects(:warn).with do |message|
303
303
  assert_match /foo/, message
304
304
  true
305
305
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.4
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -477,6 +477,7 @@ files:
477
477
  - lib/elasticsearch/api/actions/put_script.rb
478
478
  - lib/elasticsearch/api/actions/put_template.rb
479
479
  - lib/elasticsearch/api/actions/reindex.rb
480
+ - lib/elasticsearch/api/actions/remote/info.rb
480
481
  - lib/elasticsearch/api/actions/render_search_template.rb
481
482
  - lib/elasticsearch/api/actions/scroll.rb
482
483
  - lib/elasticsearch/api/actions/search.rb
@@ -494,6 +495,7 @@ files:
494
495
  - lib/elasticsearch/api/actions/snapshot/verify_repository.rb
495
496
  - lib/elasticsearch/api/actions/suggest.rb
496
497
  - lib/elasticsearch/api/actions/tasks/cancel.rb
498
+ - lib/elasticsearch/api/actions/tasks/get.rb
497
499
  - lib/elasticsearch/api/actions/tasks/list.rb
498
500
  - lib/elasticsearch/api/actions/termvectors.rb
499
501
  - lib/elasticsearch/api/actions/update.rb
@@ -504,6 +506,7 @@ files:
504
506
  - lib/elasticsearch/api/namespace/indices.rb
505
507
  - lib/elasticsearch/api/namespace/ingest.rb
506
508
  - lib/elasticsearch/api/namespace/nodes.rb
509
+ - lib/elasticsearch/api/namespace/remote.rb
507
510
  - lib/elasticsearch/api/namespace/snapshot.rb
508
511
  - lib/elasticsearch/api/namespace/tasks.rb
509
512
  - lib/elasticsearch/api/utils.rb
@@ -626,6 +629,7 @@ files:
626
629
  - test/unit/put_script_test.rb
627
630
  - test/unit/put_template_test.rb
628
631
  - test/unit/reindex_test.rb
632
+ - test/unit/remote/info_test.rb
629
633
  - test/unit/render_search_template_test.rb
630
634
  - test/unit/scroll_test.rb
631
635
  - test/unit/search_exists_test.rb
@@ -643,6 +647,7 @@ files:
643
647
  - test/unit/snapshot/verify_repository_test.rb
644
648
  - test/unit/suggest_test.rb
645
649
  - test/unit/tasks/cancel_test.rb
650
+ - test/unit/tasks/get_test.rb
646
651
  - test/unit/tasks/list_test.rb
647
652
  - test/unit/termvectors_test.rb
648
653
  - test/unit/update_by_query_test.rb
@@ -677,7 +682,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
677
682
  version: '0'
678
683
  requirements: []
679
684
  rubyforge_project:
680
- rubygems_version: 2.6.10
685
+ rubygems_version: 2.6.11
681
686
  signing_key:
682
687
  specification_version: 4
683
688
  summary: Ruby API for Elasticsearch.
@@ -800,6 +805,7 @@ test_files:
800
805
  - test/unit/put_script_test.rb
801
806
  - test/unit/put_template_test.rb
802
807
  - test/unit/reindex_test.rb
808
+ - test/unit/remote/info_test.rb
803
809
  - test/unit/render_search_template_test.rb
804
810
  - test/unit/scroll_test.rb
805
811
  - test/unit/search_exists_test.rb
@@ -817,6 +823,7 @@ test_files:
817
823
  - test/unit/snapshot/verify_repository_test.rb
818
824
  - test/unit/suggest_test.rb
819
825
  - test/unit/tasks/cancel_test.rb
826
+ - test/unit/tasks/get_test.rb
820
827
  - test/unit/tasks/list_test.rb
821
828
  - test/unit/termvectors_test.rb
822
829
  - test/unit/update_by_query_test.rb