elasticsearch-api 5.0.5 → 6.0.0

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: 01b21ab7020339d01811c0e1efdbdc55e9d04133
4
- data.tar.gz: c27e856e07e1bb3e949b5bf6bb3016a26066fa5b
3
+ metadata.gz: 63bde47c1cc7d46fc4c79164a9a42e04e400b335
4
+ data.tar.gz: 6c4edd90ed5a8ab829f86e29118cf886d188a0ca
5
5
  SHA512:
6
- metadata.gz: 8123766736b77e7d78332094d3fbb17ea84a6b0ded615ecdff059bc4016327f68c8dc1a25c2e02a719b6837793ad30fcbcd190507d9b0998b3b263f3e562e5d1
7
- data.tar.gz: 0664d1723bf50d485be46d60ff456f80c17fc13d34c14bbe2790ca795882838c874b6d9a3799f8ef446ef9b857ac263dea4cd5de2cc87e387a4f210d8b960b29
6
+ metadata.gz: a77fa034cc384ac7ed0b930584f6e7f744fe5e67a8a762a3a0984f7ee5229afad99f108815527ffa5d933e9031903382086bfe9d7abb59fd50e100c5295705c5
7
+ data.tar.gz: 35a7de732e056b4be4517785557d9ed527c57987dc46ff3e765891d36d9eedcb949a38107d17acc735e89565cfb58db59f98975468317b6f2e55f2d6c05c9632
data/Rakefile CHANGED
@@ -21,19 +21,7 @@ namespace :test do
21
21
  git_specs "fetch origin --verbose", :verbose => true
22
22
  end
23
23
 
24
- task :ci_reporter do
25
- ENV['CI_REPORTS'] ||= 'tmp/reports'
26
- if defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
27
- require 'ci/reporter/rake/test_unit'
28
- Rake::Task['ci:setup:testunit'].invoke
29
- else
30
- require 'ci/reporter/rake/minitest'
31
- Rake::Task['ci:setup:minitest'].invoke
32
- end
33
- end
34
-
35
24
  Rake::TestTask.new(:unit) do |test|
36
- Rake::Task['test:ci_reporter'].invoke if ENV['CI']
37
25
  test.libs << 'lib' << 'test'
38
26
  test.test_files = FileList["test/unit/**/*_test.rb"]
39
27
  # test.verbose = true
@@ -60,9 +48,10 @@ namespace :test do
60
48
 
61
49
  # Define the task
62
50
  t = Rake::TestTask.new(:integration) do |test|
63
- Rake::Task['test:ci_reporter'].invoke if ENV['CI']
64
51
  test.libs << 'lib' << 'test'
65
52
  test.test_files = FileList["test/integration/yaml_test_runner.rb", "test/integration/**/*_test.rb"]
53
+ test.verbose = false
54
+ test.warning = false
66
55
  end
67
56
 
68
57
  # Check if a test cluster is running
@@ -116,7 +105,6 @@ namespace :test do
116
105
 
117
106
  desc "Run unit and integration tests"
118
107
  task :all do
119
- Rake::Task['test:ci_reporter'].invoke if ENV['CI']
120
108
  Rake::Task['test:unit'].invoke
121
109
  Rake::Task['test:integration'].invoke
122
110
  end
@@ -44,7 +44,6 @@ Gem::Specification.new do |s|
44
44
  s.add_development_dependency "turn"
45
45
  s.add_development_dependency "yard"
46
46
  s.add_development_dependency "pry"
47
- s.add_development_dependency "ci_reporter", "~> 1.9"
48
47
 
49
48
  # Gems for testing integrations
50
49
  s.add_development_dependency "jsonify"
@@ -26,11 +26,21 @@ module Elasticsearch
26
26
  # @option arguments [List] :index A comma-separated list of indices to delete;
27
27
  # use `_all` to delete all indices
28
28
  # @option arguments [Time] :timeout Explicit operation timeout
29
+ # @option arguments [Time] :master_timeout Specify timeout for connection to master
30
+ # @option arguments [Boolean] :ignore_unavailable Ignore unavailable indexes (default: false)
31
+ # @option arguments [Boolean] :allow_no_indices Ignore if a wildcard expression resolves to no concrete indices (default: false)
32
+ # @option arguments [List] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (options: open, closed, none, all) (default: open)
29
33
  #
30
34
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-index/
31
35
  #
32
36
  def delete(arguments={})
33
- valid_params = [ :timeout ]
37
+ valid_params = [
38
+ :timeout,
39
+ :master_timeout,
40
+ :ignore_unavailable,
41
+ :allow_no_indices,
42
+ :expand_wildcards
43
+ ]
34
44
 
35
45
  method = HTTP_DELETE
36
46
  path = Utils.__pathify Utils.__listify(arguments[:index])
@@ -12,15 +12,14 @@ module Elasticsearch
12
12
  #
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
- # if no changes will be committed to the index. (Internal)
16
15
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
17
16
  # no concrete indices. (This includes `_all` string or when no
18
17
  # indices have been specified)
19
18
  # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
20
19
  # are open, closed or both. (options: open, closed)
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.
22
20
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
23
21
  # unavailable (missing, closed, etc)
22
+ # @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. If set to false the flush will be skipped if another flush operation is already running. (Default: true)
24
23
  #
25
24
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-flush/
26
25
  #
@@ -30,8 +29,7 @@ module Elasticsearch
30
29
  :wait_if_ongoing,
31
30
  :ignore_unavailable,
32
31
  :allow_no_indices,
33
- :expand_wildcards
34
- ]
32
+ :expand_wildcards ]
35
33
 
36
34
  method = HTTP_POST
37
35
  path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush'
@@ -0,0 +1,45 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Actions
4
+
5
+ # Execute several search requests using templates (inline, indexed or stored in a file)
6
+ #
7
+ # @example Search with an inline script
8
+ #
9
+ # client.msearch_template body: [
10
+ # { index: 'test' },
11
+ # { inline: { query: { match: { title: '{{q}}' } } }, params: { q: 'foo'} }
12
+ # ]
13
+ #
14
+ # @option arguments [List] :index A comma-separated list of index names to use as default
15
+ # @option arguments [List] :type A comma-separated list of document types to use as default
16
+ # @option arguments [Hash] :body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*)
17
+ # @option arguments [String] :search_type Search operation type (options: query_then_fetch, query_and_fetch, dfs_query_then_fetch, dfs_query_and_fetch)
18
+ #
19
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-search-template.html
20
+ #
21
+ def msearch_template(arguments={})
22
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
23
+
24
+ valid_params = [ :search_type ]
25
+ method = HTTP_GET
26
+ path = Utils.__pathify Utils.__listify(arguments[:index]),
27
+ Utils.__listify(arguments[:type]),
28
+ '_msearch/template'
29
+ params = Utils.__validate_and_extract_params arguments, valid_params
30
+ body = arguments[:body]
31
+
32
+ case
33
+ when body.is_a?(Array)
34
+ payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) }
35
+ payload << "" unless payload.empty?
36
+ payload = payload.join("\n")
37
+ else
38
+ payload = body
39
+ end
40
+
41
+ perform_request(method, path, params, payload).body
42
+ end
43
+ end
44
+ end
45
+ end
@@ -7,11 +7,48 @@ 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
- # @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
10
+ # @example Register queries named "alert-1" and "alert-2" for the "my-index" index
13
11
  #
14
- # See full example for Elasticsearch 5.x and higher in <https://github.com/elastic/elasticsearch-ruby/blob/master/examples/percolator/percolator_alerts.rb>
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'} ]}
15
52
  #
16
53
  # @option arguments [String] :index The index of the document being percolated. (*Required*)
17
54
  # @option arguments [String] :type The type of the document being percolated. (*Required*)
@@ -38,8 +75,6 @@ module Elasticsearch
38
75
  # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
39
76
  #
40
77
  def percolate(arguments={})
41
- Utils.__report_unsupported_method :percolate
42
-
43
78
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
44
79
  raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
45
80
 
@@ -43,11 +43,9 @@ 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.
51
49
  #
52
50
  # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html
53
51
  #
@@ -58,8 +56,7 @@ module Elasticsearch
58
56
  :timeout,
59
57
  :consistency,
60
58
  :wait_for_completion,
61
- :requests_per_second,
62
- :slices ]
59
+ :requests_per_second ]
63
60
  method = 'POST'
64
61
  path = "_reindex"
65
62
  params = Utils.__validate_and_extract_params arguments, valid_params
@@ -116,6 +116,8 @@ module Elasticsearch
116
116
  # @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
117
117
  # @option arguments [Boolean] :version Specify whether to return document version as part of a hit
118
118
  # @option arguments [Number] :batched_reduce_size The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.
119
+ # @option arguments [Number] :max_concurrent_shard_requests The number of concurrent shard requests this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests. The default grows with the number of nodes in the cluster but is at most 256.
120
+ # @option arguments [Number] :pre_filter_shard_size A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. (Default: 128)
119
121
  #
120
122
  # @return [Hash]
121
123
  #
@@ -165,7 +167,9 @@ module Elasticsearch
165
167
  :timeout,
166
168
  :typed_keys,
167
169
  :version,
168
- :batched_reduce_size ]
170
+ :batched_reduce_size,
171
+ :max_concurrent_shard_requests,
172
+ :pre_filter_shard_size ]
169
173
 
170
174
  method = HTTP_GET
171
175
  path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), UNDERSCORE_SEARCH )
@@ -21,7 +21,7 @@ module Elasticsearch
21
21
  # @option arguments [List] :snapshot A comma-separated list of snapshot names (*Required*)
22
22
  # @option arguments [Boolean] :ignore_unavailable Whether to ignore unavailable snapshots, defaults to # false which means a SnapshotMissingException is thrown
23
23
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
24
- # @option arguments [Number,List] :ignore The list of HTTP errors to ignore
24
+ # @option arguments [Boolean] :verbose Whether to show verbose snapshot info or only show the basic info found in the repository index blob
25
25
  #
26
26
  # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-snapshots.html
27
27
  #
@@ -31,7 +31,8 @@ module Elasticsearch
31
31
 
32
32
  valid_params = [
33
33
  :ignore_unavailable,
34
- :master_timeout ]
34
+ :master_timeout,
35
+ :verbose ]
35
36
 
36
37
  repository = arguments.delete(:repository)
37
38
  snapshot = arguments.delete(:snapshot)
@@ -235,12 +235,10 @@ module Elasticsearch
235
235
  end
236
236
 
237
237
  unless messages.empty?
238
- messages << "Suppress this warning by the `-WO` command line flag."
239
-
240
238
  if STDERR.tty?
241
- Kernel.warn messages.map { |m| "\e[31;1m#{m}\e[0m" }.join("\n")
239
+ STDERR.puts messages.map { |m| "\e[31;1m#{m}\e[0m" }.join("\n")
242
240
  else
243
- Kernel.warn messages.join("\n")
241
+ STDERR.puts messages.join("\n")
244
242
  end
245
243
  end
246
244
  end
@@ -251,12 +249,12 @@ module Elasticsearch
251
249
  message += " in `#{source}`"
252
250
  end
253
251
 
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."
252
+ message += ". This method is not supported in the version you're using: #{Elasticsearch::API::VERSION}, and will be removed in the next release."
255
253
 
256
254
  if STDERR.tty?
257
- Kernel.warn "\e[31;1m#{message}\e[0m"
255
+ STDERR.puts "\e[31;1m#{message}\e[0m"
258
256
  else
259
- Kernel.warn message
257
+ STDERR.puts message
260
258
  end
261
259
  end
262
260
 
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "5.0.5"
3
+ VERSION = "6.0.0"
4
4
  end
5
5
  end
@@ -332,7 +332,13 @@ suites.each do |suite|
332
332
 
333
333
  files = Dir[suite.join('*.{yml,yaml}')]
334
334
  files.each do |file|
335
- tests = YAML.load_documents File.new(file)
335
+ begin
336
+ tests = YAML.load_documents File.new(file)
337
+ rescue Exception => e
338
+ $stderr.puts "ERROR [#{e.class}] while loading [#{file}] file".ansi(:red)
339
+ # raise e
340
+ next
341
+ end
336
342
 
337
343
  # Extract setup actions
338
344
  setup_actions = tests.select { |t| t['setup'] }.first['setup'] rescue []
@@ -0,0 +1,60 @@
1
+ require 'test_helper'
2
+
3
+ module Elasticsearch
4
+ module Test
5
+ class MsearchTemplateTest < ::Test::Unit::TestCase
6
+
7
+ context "Msearch Template" do
8
+ subject { FakeClient.new }
9
+
10
+ should "require the :body argument" do
11
+ assert_raise ArgumentError do
12
+ subject.msearch
13
+ end
14
+ end
15
+
16
+ should "serialize and post header/data pairs" do
17
+ subject.expects(:perform_request).with do |method, url, params, body|
18
+ assert_equal 'GET', method
19
+ assert_equal '_msearch/template', url
20
+ assert_equal Hash.new, params
21
+ assert_equal <<-PAYLOAD.gsub(/^\s+/, ''), body
22
+ {"index":"foo"}
23
+ {"inline":{"query":{"match":{"foo":"{{q}}"}}},"params":{"q":"foo"}}
24
+ {"index":"bar"}
25
+ {"id":"query_foo","params":{"q":"foo"}}
26
+ PAYLOAD
27
+ true
28
+ end.returns(FakeResponse.new)
29
+
30
+ subject.msearch_template :body => [
31
+ { :index => 'foo' },
32
+ { :inline => { :query => { :match => { :foo => '{{q}}' } } }, :params => { :q => 'foo' } },
33
+ { :index => 'bar' },
34
+ { :id => 'query_foo', :params => { :q => 'foo' } }
35
+ ]
36
+ end
37
+
38
+ should "post a string payload intact" do
39
+ subject.expects(:perform_request).with do |method, url, params, body|
40
+ assert_equal %Q|{"foo":"bar"}\n{"moo":"lam"}|, body
41
+ true
42
+ end.returns(FakeResponse.new)
43
+
44
+ subject.msearch_template :body => %Q|{"foo":"bar"}\n{"moo":"lam"}|
45
+ end
46
+
47
+ should "perform request against an index" do
48
+ subject.expects(:perform_request).with do |method, url, params, body|
49
+ assert_equal 'foo/_msearch/template', url
50
+ true
51
+ end.returns(FakeResponse.new)
52
+
53
+ subject.msearch_template :index => 'foo', :body => []
54
+ end
55
+
56
+ end
57
+
58
+ end
59
+ end
60
+ 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
- Kernel.expects(:warn).with do |message|
257
- assert_equal 2, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
256
+ STDERR.expects(:puts).with do |message|
257
+ assert_equal 2, message.split("\n").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
- Kernel.expects(:warn).with do |message|
268
+ STDERR.expects(:puts).with do |message|
269
269
  assert_match /NOT_SUPPORTED/, message
270
- assert_equal 1, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
270
+ assert_equal 1, message.split("\n").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
- Kernel.expects(:warn).with do |message|
281
+ STDERR.expects(:puts).with do |message|
282
282
  assert_match /NOT_SUPPORTED/, message
283
- assert_equal 2, message.split("\n").reject { |l| l.include? 'Suppress this warning' }.size
283
+ assert_equal 2, message.split("\n").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
- Kernel.expects(:warn).never
294
+ STDERR.expects(:puts).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
- Kernel.expects(:warn).with do |message|
302
+ STDERR.expects(:puts).with do |message|
303
303
  assert_match /foo/, message
304
304
  true
305
305
  end
@@ -62,7 +62,7 @@ module Elasticsearch
62
62
  @namespace_depth = @full_namespace.size > 0 ? @full_namespace.size-1 : 0
63
63
  @module_namespace = @full_namespace[0, @namespace_depth]
64
64
  @method_name = @full_namespace.last
65
- @http_method = "HTTP_#{@spec['methods'].first}"
65
+ @http_method = "Elasticsearch::API::HTTP_#{@spec['methods'].first}"
66
66
  @http_path = unless @spec['url']['parts'].empty?
67
67
  @spec['url']['path']
68
68
  .split('/')
@@ -111,7 +111,7 @@ module Elasticsearch
111
111
 
112
112
  # -- Tree output
113
113
 
114
- if options[:verbose] && `which tree > /dev/null 2>&1`
114
+ if options[:verbose] && `which tree > /dev/null 2>&1; echo $?`.to_i < 1
115
115
  lines = `tree #{@output}`.split("\n")
116
116
  say_status 'tree',
117
117
  lines.first + "\n" + lines[1, lines.size].map { |l| ' '*14 + l }.join("\n")
@@ -10,20 +10,20 @@ module Elasticsearch
10
10
  <%# URL parts -%>
11
11
  <%- @spec['url']['parts'].each do |name,info| -%>
12
12
  <%- info['type'] = 'String' if info['type'] == 'enum' # Rename 'enums' to 'strings' -%>
13
- <%= ' '*@namespace_depth + "# @option arguments [#{info['type'] ? info['type'].capitalize : 'String'}] :#{name} #{info['description']}" + ( info['required'] ? ' (*Required*)' : '' ) -%><%= " (options: #{info['options'].join(', ')})" if info['options'] -%>
13
+ <%= ' '*@namespace_depth + "# @option arguments [#{info['type'] ? info['type'].capitalize : 'String'}] :#{name} #{info['description'] ? info['description'].strip : '[TODO]'}" + ( info['required'] ? ' (*Required*)' : '' ) -%><%= " (options: #{info['options'].join(', '.strip)})" if info['options'] -%>
14
14
  <%= "\n" -%>
15
15
  <%- end -%>
16
16
  <%# Body -%>
17
- <%= ' '*(@namespace_depth+3) + '# @option arguments [Hash] :body ' + (@spec['body']['description'] || 'TODO: Description') + (@spec['body']['required'] ? ' (*Required*)' : '') + "\n" if @spec['body'] -%>
17
+ <%= ' '*(@namespace_depth+3) + '# @option arguments [Hash] :body ' + (@spec['body']['description'] ? @spec['body']['description'].strip : 'TODO: Description') + (@spec['body']['required'] ? ' (*Required*)' : '') + "\n" if @spec['body'] -%>
18
18
  <%# URL parameters -%>
19
19
  <%- @spec['url']['params'].each do |name,info| -%>
20
20
  <%- info['type'] = 'String' if info['type'] == 'enum' # Rename 'enums' to 'strings' -%>
21
- <%= ' '*@namespace_depth + "# @option arguments [#{info['type'] ? info['type'].capitalize : 'String'}] :#{name} #{info['description']}" -%><%= " (options: #{info['options'].join(', ')})" if info['options'] -%>
21
+ <%= ' '*@namespace_depth + "# @option arguments [#{info['type'] ? info['type'].capitalize : 'String'}] :#{name} #{info['description'] ? info['description'].strip : '[TODO]'}" -%><%= " (options: #{info['options'].join(', ')})" if info['options'] -%>
22
22
  <%= "\n" -%>
23
23
  <%- end if @spec['url']['parts'] -%>
24
24
  <%= ' '*@namespace_depth -%>#
25
25
  <%# Documentation link -%>
26
- <%= ' '*@namespace_depth %># @see <%= @spec['documentation'] %>
26
+ <%= ' '*@namespace_depth %># @see <%= @spec['documentation'] ? @spec['documentation'] : "[TODO]" %>
27
27
  <%= ' '*@namespace_depth %>#
28
28
  <%# Method definition -%>
29
29
  <%= ' '*@namespace_depth -%>def <%= @method_name %>(arguments={})
@@ -42,7 +42,7 @@ module Elasticsearch
42
42
  <%= ' '*@namespace_depth %> method = <%= @http_method %>
43
43
  <%= ' '*@namespace_depth %> path = "<%= @http_path %>"
44
44
  <%- unless @spec['url']['params'].empty? -%>
45
- <%= ' '*@namespace_depth %> params = Utils.__validate_and_extract_params arguments, valid_params
45
+ <%= ' '*@namespace_depth %> params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
46
46
  <%- else -%>
47
47
  <%= ' '*@namespace_depth %> params = {}
48
48
  <%- end -%>
@@ -16,7 +16,7 @@ module Elasticsearch
16
16
  true
17
17
  end.returns(FakeResponse.new)
18
18
 
19
- subject.<%= @full_namespace.join('.') %> <%= @spec['url']['parts'].select { |name, info| info['required'] }.keys.map { |d| ":#{d} => 'foo'" }.join(', ') %>
19
+ subject.<%= @full_namespace.join('.') %> <%= @spec['url']['parts'].select { |name, info| info['required'] }.keys.map { |d| ":#{d} => 'foo'" }.join(', ') rescue '' %>
20
20
  end
21
21
 
22
22
  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.5
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-25 00:00:00.000000000 Z
11
+ date: 2017-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -192,20 +192,6 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: ci_reporter
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '1.9'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: '1.9'
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: jsonify
211
197
  requirement: !ruby/object:Gem::Requirement
@@ -467,6 +453,7 @@ files:
467
453
  - lib/elasticsearch/api/actions/mlt.rb
468
454
  - lib/elasticsearch/api/actions/mpercolate.rb
469
455
  - lib/elasticsearch/api/actions/msearch.rb
456
+ - lib/elasticsearch/api/actions/msearch_template.rb
470
457
  - lib/elasticsearch/api/actions/mtermvectors.rb
471
458
  - lib/elasticsearch/api/actions/nodes/hot_threads.rb
472
459
  - lib/elasticsearch/api/actions/nodes/info.rb
@@ -618,6 +605,7 @@ files:
618
605
  - test/unit/mget_test.rb
619
606
  - test/unit/mlt_test.rb
620
607
  - test/unit/mpercolate_test.rb
608
+ - test/unit/msearch_template_test.rb
621
609
  - test/unit/msearch_test.rb
622
610
  - test/unit/mtermvectors_test.rb
623
611
  - test/unit/nodes/hot_threads_test.rb
@@ -682,7 +670,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
682
670
  version: '0'
683
671
  requirements: []
684
672
  rubyforge_project:
685
- rubygems_version: 2.6.11
673
+ rubygems_version: 2.5.2
686
674
  signing_key:
687
675
  specification_version: 4
688
676
  summary: Ruby API for Elasticsearch.
@@ -794,6 +782,7 @@ test_files:
794
782
  - test/unit/mget_test.rb
795
783
  - test/unit/mlt_test.rb
796
784
  - test/unit/mpercolate_test.rb
785
+ - test/unit/msearch_template_test.rb
797
786
  - test/unit/msearch_test.rb
798
787
  - test/unit/mtermvectors_test.rb
799
788
  - test/unit/nodes/hot_threads_test.rb