elasticsearch-api 1.0.7 → 1.0.9

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: 25fb9700e6298b2c6a37cd1a114041689e9cbfd4
4
- data.tar.gz: c04e61a9efce06dbecdec9f45681259dc3a26ff5
3
+ metadata.gz: 8117b07c3656cd36592dc6a74685015a35a77125
4
+ data.tar.gz: f9673514f128f2de7b6e11fbdf456cc890f96122
5
5
  SHA512:
6
- metadata.gz: 570c0084b961fccc4741ba790dc93edef6562027c531c3019535143c2e1161dcfbb064058eb55016afce2bced5a70126c7a24e062728ae5e44be8ff9d01bc661
7
- data.tar.gz: bbe4bc6dd89766e037af5ac4ac38abd80f7df830caf3a75f221a5874266cc0275f6a6ba4e1028a1893a4788dd1a184043e1dca95f384686addf90aec3ee37750
6
+ metadata.gz: 756a663f49e4f94ddf31c28430f39f1683cbb92da3eeee1cf6d3c9851f064f00328e02de0e37f59e5c95ff1157aab0bc1398a533f24fa6d12d58450e3f6ce5e1
7
+ data.tar.gz: 0660cf068a76559597c9d17df4604c2d6855d615c98230ca242c231a35b60b1a0f0da324a3f148c464359072cb4a345becef650e70d43f6f276464541b7719c3
@@ -50,7 +50,7 @@ module Elasticsearch
50
50
  # @option arguments [String] :consistency Explicit write consistency setting for the operation
51
51
  # (options: one, quorum, all)
52
52
  # @option arguments [Boolean] :refresh Refresh the index after performing the operation
53
- # @option arguments [String] :replication Explicitely set the replication type (options: sync, async)
53
+ # @option arguments [String] :replication Explicitly set the replication type (options: sync, async)
54
54
  # @option arguments [Time] :timeout Explicit operation timeout
55
55
  #
56
56
  # @return [Hash] Deserialized Elasticsearch response
@@ -0,0 +1,34 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Cat
4
+ module Actions
5
+
6
+ # Return information about installed plugins
7
+ #
8
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
9
+ # (default: false)
10
+ # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
11
+ # @option arguments [List] :h Comma-separated list of column names to display
12
+ # @option arguments [Boolean] :help Return help information
13
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
14
+ #
15
+ # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html
16
+ #
17
+ def plugins(arguments={})
18
+ valid_params = [
19
+ :local,
20
+ :master_timeout,
21
+ :h,
22
+ :help,
23
+ :v ]
24
+ method = 'GET'
25
+ path = "/_cat/plugins"
26
+ params = Utils.__validate_and_extract_params arguments, valid_params
27
+ body = nil
28
+
29
+ perform_request(method, path, params, body).body
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -12,7 +12,7 @@ module Elasticsearch
12
12
  def clear_scroll(arguments={})
13
13
  raise ArgumentError, "Required argument 'scroll_id' missing" unless arguments[:scroll_id]
14
14
 
15
- scroll_id = arguments.delete(:scroll_id)
15
+ scroll_id = arguments[:body] || arguments.delete(:scroll_id)
16
16
 
17
17
  scroll_ids = case scroll_id
18
18
  when Array
@@ -16,7 +16,7 @@ module Elasticsearch
16
16
  # ]
17
17
  # }
18
18
  #
19
- # @note If you want to explicitely set the shard allocation to a certain node, you might
19
+ # @note If you want to explicitly set the shard allocation to a certain node, you might
20
20
  # want to look at the `allocation.*` cluster settings.
21
21
  #
22
22
  # @option arguments [Hash] :body The definition of `commands` to perform (`move`, `cancel`, `allocate`)
@@ -18,32 +18,47 @@ module Elasticsearch
18
18
  #
19
19
  # @option arguments [List] :index A comma-separated list of indices to restrict the results
20
20
  # @option arguments [List] :type A comma-separated list of types to restrict the results
21
- # @option arguments [Hash] :body A query to restrict the results (optional)
22
- # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
23
- # no concrete indices. (This includes `_all` string or when no
24
- # indices have been specified)
25
- # @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
26
- # `missing` ones (options: none, missing) @until 1.0
21
+ # @option arguments [Hash] :body A query to restrict the results specified with the Query DSL (optional)
27
22
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
28
- # unavailable (missing, closed, etc)
23
+ # unavailable (missing or closed)
24
+ # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves
25
+ # into no concrete indices.
26
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices
27
+ # that are open, closed or both.
28
+ # (options: open, closed, none, all)
29
29
  # @option arguments [Number] :min_score Include only documents with a specific `_score` value in the result
30
30
  # @option arguments [String] :preference Specify the node or shard the operation should be performed on
31
31
  # (default: random)
32
32
  # @option arguments [String] :routing Specific routing value
33
- # @option arguments [String] :source The URL-encoded query definition (instead of using the request body)
33
+ # @option arguments [String] :q Query in the Lucene query string syntax
34
+ # @option arguments [String] :analyzer The analyzer to use for the query string
35
+ # @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be
36
+ # analyzed (default: false)
37
+ # @option arguments [String] :default_operator The default operator for query string query (AND or OR)
38
+ # (options: AND, OR)
39
+ # @option arguments [String] :df The field to use as default where no field prefix is given in the query
40
+ # string
41
+ # @option arguments [Boolean] :lenient Specify whether format-based query failures (such as providing text
42
+ # to a numeric field) should be ignored
43
+ # @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
34
44
  #
35
45
  # @see http://elasticsearch.org/guide/reference/api/count/
36
46
  #
37
47
  def count(arguments={})
38
48
  valid_params = [
39
- :ignore_indices,
40
49
  :ignore_unavailable,
41
50
  :allow_no_indices,
42
51
  :expand_wildcards,
43
52
  :min_score,
44
53
  :preference,
45
54
  :routing,
46
- :source ]
55
+ :q,
56
+ :analyzer,
57
+ :analyze_wildcard,
58
+ :default_operator,
59
+ :df,
60
+ :lenient,
61
+ :lowercase_expanded_terms ]
47
62
 
48
63
  method = HTTP_GET
49
64
  path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_count' )
@@ -6,7 +6,7 @@ module Elasticsearch
6
6
  #
7
7
  # @example
8
8
  #
9
- # client.exists index: 'myindex', type: 'mytype', id: '1'
9
+ # client.exists? index: 'myindex', type: 'mytype', id: '1'
10
10
  #
11
11
  # @option arguments [String] :id The document ID (*Required*)
12
12
  # @option arguments [String] :index The name of the index (*Required*)
@@ -0,0 +1,32 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Actions
4
+
5
+ # Returns statistical information about a field without executing a search.
6
+ #
7
+ # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
8
+ # @option arguments [List] :fields A comma-separated list of fields for to get field statistics for (min value, max value, and more)
9
+ # @option arguments [String] :level Defines if field stats should be returned on a per index level or on a cluster wide level (options: indices, cluster)
10
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
11
+ # @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)
12
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
13
+ #
14
+ # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-stats.html
15
+ #
16
+ def field_stats(arguments={})
17
+ valid_params = [
18
+ :fields,
19
+ :level,
20
+ :ignore_unavailable,
21
+ :allow_no_indices,
22
+ :expand_wildcards ]
23
+ method = 'GET'
24
+ path = "_field_stats"
25
+ params = Utils.__validate_and_extract_params arguments, valid_params
26
+ body = nil
27
+
28
+ perform_request(method, path, params, body).body
29
+ end
30
+ end
31
+ end
32
+ end
@@ -28,6 +28,7 @@ module Elasticsearch
28
28
  # or a list of fields to return
29
29
  # @option arguments [String] :_source_exclude A list of fields to exclude from the returned _source field
30
30
  # @option arguments [String] :_source_include A list of fields to extract and return from the _source field
31
+ # @option arguments [Boolean] :_source_transform Retransform the source before returning it
31
32
  #
32
33
  # @see http://elasticsearch.org/guide/reference/api/get/
33
34
  #
@@ -47,7 +48,8 @@ module Elasticsearch
47
48
  :version_type,
48
49
  :_source,
49
50
  :_source_include,
50
- :_source_exclude ]
51
+ :_source_exclude,
52
+ :_source_transform]
51
53
 
52
54
  method = HTTP_GET
53
55
  path = Utils.__pathify Utils.__escape(arguments[:index]),
@@ -17,6 +17,11 @@ module Elasticsearch
17
17
  body = arguments[:body]
18
18
 
19
19
  perform_request(method, path, params, body).body
20
+ rescue Exception => e
21
+ # NOTE: Use exception name, not full class in Elasticsearch::Client to allow client plugability
22
+ if Array(arguments[:ignore]).include?(404) && e.class.to_s =~ /NotFound/; false
23
+ else raise(e)
24
+ end
20
25
  end
21
26
  end
22
27
  end
@@ -21,12 +21,21 @@ module Elasticsearch
21
21
  #
22
22
  # @note If your text for analysis is longer than 4096 bytes then you should use the :body argument, rather than :text, to avoid HTTP transport errors
23
23
  #
24
+ # @example Analyze text "Quick <b>Brown</b> Jumping Fox" with custom tokenizer, token and character filters
25
+ #
26
+ # client.indices.analyze text: 'The Quick <b>Brown</b> Jumping Fox',
27
+ # tokenizer: 'standard',
28
+ # token_filters: 'lowercase,stop',
29
+ # char_filters: 'html_strip'
30
+ #
24
31
  # @option arguments [String] :index The name of the index to scope the operation
25
32
  # @option arguments [String] :body The text on which the analysis should be performed
26
33
  # @option arguments [String] :analyzer The name of the analyzer to use
27
34
  # @option arguments [String] :field Use the analyzer configured for this field
28
35
  # (instead of passing the analyzer name)
29
- # @option arguments [List] :filters A comma-separated list of filters to use for the analysis
36
+ # @option arguments [List] :filters A comma-separated list of token filters to use for the analysis.
37
+ # (Also available as the `:token_filters` option)
38
+ # @option arguments [List] :char_filters A comma-separated list of char filters to use for the analysis
30
39
  # @option arguments [String] :index The name of the index to scope the operation
31
40
  # @option arguments [Boolean] :prefer_local With `true`, specify that a local shard should be used if available,
32
41
  # with `false`, use a random shard (default: true)
@@ -40,12 +49,14 @@ module Elasticsearch
40
49
  def analyze(arguments={})
41
50
  valid_params = [
42
51
  :analyzer,
52
+ :char_filters,
43
53
  :field,
44
54
  :filters,
45
55
  :index,
46
56
  :prefer_local,
47
57
  :text,
48
58
  :tokenizer,
59
+ :token_filters,
49
60
  :format ]
50
61
 
51
62
  method = HTTP_GET
@@ -7,7 +7,7 @@ module Elasticsearch
7
7
  #
8
8
  # @example Check whether index named _myindex_ exists
9
9
  #
10
- # client.indices.exists index: 'myindex'
10
+ # client.indices.exists? index: 'myindex'
11
11
  #
12
12
  # @option arguments [List] :index A comma-separated list of indices to check (*Required*)
13
13
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
@@ -7,7 +7,7 @@ module Elasticsearch
7
7
  #
8
8
  # @example Check whether index alias named _myalias_ exists
9
9
  #
10
- # client.indices.exists_alias name: 'myalias'
10
+ # client.indices.exists_alias? name: 'myalias'
11
11
  #
12
12
  # @option arguments [List] :index A comma-separated list of index names to filter aliases
13
13
  # @option arguments [List] :name A comma-separated list of alias names to return
@@ -3,7 +3,9 @@ module Elasticsearch
3
3
  module Indices
4
4
  module Actions
5
5
 
6
- # TODO: Description
6
+ # Return true if the specified index template exists, false otherwise.
7
+ #
8
+ # client.indices.exists_template? name: 'mytemplate'
7
9
  #
8
10
  # @option arguments [String] :name The name of the template (*Required*)
9
11
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
@@ -29,6 +31,8 @@ module Elasticsearch
29
31
  raise e
30
32
  end
31
33
  end
34
+
35
+ alias_method :exists_template?, :exists_template
32
36
  end
33
37
  end
34
38
  end
@@ -5,6 +5,8 @@ module Elasticsearch
5
5
 
6
6
  # Return true if the specified type exists, false otherwise.
7
7
  #
8
+ # client.indices.exists_type? type: 'mytype'
9
+ #
8
10
  # @option arguments [List] :index A comma-separated list of index names; use `_all`
9
11
  # to check the types across all indices (*Required*)
10
12
  # @option arguments [List] :type A comma-separated list of document types to check (*Required*)
@@ -8,7 +8,7 @@ module Elasticsearch
8
8
  # By default, Elasticsearch has a delay of 1 second until changes to an index are
9
9
  # available for search; the delay is configurable, see {Indices::Actions#put_settings}.
10
10
  #
11
- # You can trigger this operation explicitely, for example when performing a sequence of commands
11
+ # You can trigger this operation explicitly, for example when performing a sequence of commands
12
12
  # in integration tests, or when you need to perform a manual "synchronization" of the index
13
13
  # with an external system at given moment.
14
14
  #
@@ -38,31 +38,44 @@ module Elasticsearch
38
38
  # use `_all` or empty string to perform the operation on all indices
39
39
  # @option arguments [List] :type A comma-separated list of document types to restrict the operation;
40
40
  # leave empty to perform the operation on all types
41
- # @option arguments [Hash] :body The query definition (*without* the top-level `query` element)
42
- # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
43
- # no concrete indices. (This includes `_all` string or when no
44
- # indices have been specified)
45
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
46
- # are open, closed or both. (options: open, closed)
41
+ # @option arguments [Hash] :body The query definition specified with the Query DSL
47
42
  # @option arguments [Boolean] :explain Return detailed information about the error
48
- # @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
49
- # `missing` ones (options: none, missing) @until 1.0
50
- # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
51
- # unavailable (missing, closed, etc)
52
- # @option arguments [String] :source The URL-encoded query definition (instead of using the request body)
43
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored
44
+ # when unavailable (missing or closed)
45
+ # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression
46
+ # resolves into no concrete indices.
47
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices
48
+ # that are open, closed or both.
49
+ # (options: open, closed, none, all)
50
+ # @option arguments [String] :operation_threading TODO: ?
53
51
  # @option arguments [String] :q Query in the Lucene query string syntax
52
+ # @option arguments [String] :analyzer The analyzer to use for the query string
53
+ # @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be
54
+ # analyzed (default: false)
55
+ # @option arguments [String] :default_operator The default operator for query string query (AND or OR)
56
+ # (options: AND, OR)
57
+ # @option arguments [String] :df The field to use as default where no field prefix is given in
58
+ # the query string
59
+ # @option arguments [Boolean] :lenient Specify whether format-based query failures (such as providing
60
+ # text to a numeric field) should be ignored
61
+ # @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
54
62
  #
55
63
  # @see http://www.elasticsearch.org/guide/reference/api/validate/
56
64
  #
57
65
  def validate_query(arguments={})
58
66
  valid_params = [
59
- :q,
60
67
  :explain,
61
- :ignore_indices,
62
68
  :ignore_unavailable,
63
69
  :allow_no_indices,
64
70
  :expand_wildcards,
65
- :source ]
71
+ :operation_threading,
72
+ :q,
73
+ :analyzer,
74
+ :analyze_wildcard,
75
+ :default_operator,
76
+ :df,
77
+ :lenient,
78
+ :lowercase_expanded_terms ]
66
79
 
67
80
  method = HTTP_GET
68
81
  path = Utils.__pathify Utils.__listify(arguments[:index]),
@@ -51,7 +51,7 @@ module Elasticsearch
51
51
  :scroll_id ]
52
52
 
53
53
  params = Utils.__validate_and_extract_params arguments, valid_params
54
- body = params.delete(:scroll_id) || arguments[:body]
54
+ body = arguments[:body] || params.delete(:scroll_id)
55
55
 
56
56
  perform_request(method, path, params, body).body
57
57
  end
@@ -0,0 +1,59 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Actions
4
+
5
+ # Return whether documents exists for a particular query
6
+ #
7
+ # @option arguments [List] :index A comma-separated list of indices to restrict the results
8
+ # @option arguments [List] :type A comma-separated list of types to restrict the results
9
+ # @option arguments [Hash] :body A query to restrict the results specified with the Query DSL (optional)
10
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
11
+ # unavailable (missing or closed)
12
+ # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves
13
+ # into no concrete indices.
14
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices
15
+ # that are open, closed or both.
16
+ # (options: open, closed, none, all)
17
+ # @option arguments [Number] :min_score Include only documents with a specific `_score` value in the result
18
+ # @option arguments [String] :preference Specify the node or shard the operation should be performed on
19
+ # (default: random)
20
+ # @option arguments [String] :routing Specific routing value
21
+ # @option arguments [String] :q Query in the Lucene query string syntax
22
+ # @option arguments [String] :analyzer The analyzer to use for the query string
23
+ # @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be
24
+ # analyzed (default: false)
25
+ # @option arguments [String] :default_operator The default operator for query string query (AND or OR)
26
+ # (options: AND, OR)
27
+ # @option arguments [String] :df The field to use as default where no field prefix is given
28
+ # in the query string
29
+ # @option arguments [Boolean] :lenient Specify whether format-based query failures
30
+ # (such as providing text to a numeric field) should be ignored
31
+ # @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased
32
+ #
33
+ # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-exists.html
34
+ #
35
+ def search_exists(arguments={})
36
+ valid_params = [
37
+ :ignore_unavailable,
38
+ :allow_no_indices,
39
+ :expand_wildcards,
40
+ :min_score,
41
+ :preference,
42
+ :routing,
43
+ :q,
44
+ :analyzer,
45
+ :analyze_wildcard,
46
+ :default_operator,
47
+ :df,
48
+ :lenient,
49
+ :lowercase_expanded_terms ]
50
+ method = 'POST'
51
+ path = "_search/exists"
52
+ params = Utils.__validate_and_extract_params arguments, valid_params
53
+ body = arguments[:body]
54
+
55
+ perform_request(method, path, params, body).body
56
+ end
57
+ end
58
+ end
59
+ end
@@ -3,7 +3,7 @@ module Elasticsearch
3
3
  module Snapshot
4
4
  module Actions
5
5
 
6
- # Explicitely perform the verification of a repository
6
+ # Explicitly perform the verification of a repository
7
7
  #
8
8
  # @option arguments [String] :repository A repository name (*Required*)
9
9
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "1.0.7"
3
+ VERSION = "1.0.9"
4
4
  end
5
5
  end
@@ -76,7 +76,8 @@ tracer.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
76
76
  #
77
77
  # ruby -I lib:test -r ./tmp/my_special_client.rb test/integration/yaml_test_runner.rb
78
78
  #
79
- $client ||= Elasticsearch::Client.new host: "localhost:#{ENV['TEST_CLUSTER_PORT'] || 9250}"
79
+ url = ENV.fetch('TEST_CLUSTER_URL', "http://localhost:#{ENV['TEST_CLUSTER_PORT'] || 9250}")
80
+ $client ||= Elasticsearch::Client.new url: url
80
81
 
81
82
  $client.transport.logger = logger unless ENV['QUIET'] || ENV['CI']
82
83
  $client.transport.tracer = tracer if ENV['CI']
@@ -223,6 +224,9 @@ module Elasticsearch
223
224
 
224
225
  # Skip version
225
226
  if skip && skip['skip']['version']
227
+
228
+ return skip['skip']['reason'] ? skip['skip']['reason'] : true if skip['skip']['version'] == 'all'
229
+
226
230
  min, max = skip['skip']['version'].split('-').map(&:strip)
227
231
 
228
232
  min_normalized = sprintf "%03d-%03d-%03d",
@@ -238,7 +242,7 @@ module Elasticsearch
238
242
 
239
243
  es_normalized = sprintf "%03d-%03d-%03d", *$es_version.split('.').map(&:to_i)
240
244
 
241
- if min_normalized <= es_normalized && max_normalized >= es_normalized
245
+ if ( min.empty? || min_normalized <= es_normalized ) && ( max.empty? || max_normalized >= es_normalized )
242
246
  return skip['skip']['reason'] ? skip['skip']['reason'] : true
243
247
  end
244
248
 
@@ -348,8 +352,14 @@ suites.each do |suite|
348
352
  begin
349
353
  $results[test.hash] = Runner.perform_api_call(test, api, arguments)
350
354
  rescue Exception => e
355
+ begin
356
+ $results[test.hash] = MultiJson.load(e.message.match(/{.+}/, 1).to_s)
357
+ rescue MultiJson::ParseError
358
+ $stderr.puts "RESPONSE: Cannot parse JSON from error message: '#{e.message}'" if ENV['DEBUG']
359
+ end
360
+
351
361
  if catch_exception
352
- $stderr.puts "CATCH '#{catch_exception}': #{e.inspect}" if ENV['DEBUG']
362
+ $stderr.puts "CATCH: '#{catch_exception}': #{e.inspect}" if ENV['DEBUG']
353
363
  case e
354
364
  when 'missing'
355
365
  assert_match /\[404\]/, e.message
@@ -400,6 +410,7 @@ suites.each do |suite|
400
410
  else
401
411
  value = value.reduce({}) { |memo, (k,v)| memo[k] = Runner.fetch_or_return(v); memo } if value.is_a? Hash
402
412
  $stderr.puts "CHECK: Expected '#{property}' to be '#{value}', is: #{result.inspect}" if ENV['DEBUG']
413
+
403
414
  assert_equal(value, result)
404
415
  end
405
416
 
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Elasticsearch
4
+ module Test
5
+ class CatPluginsTest < ::Test::Unit::TestCase
6
+
7
+ context "Cat: Plugins" 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 '/_cat/plugins', url
14
+ assert_equal Hash.new, params
15
+ assert_nil body
16
+ true
17
+ end.returns(FakeResponse.new)
18
+
19
+ subject.cat.plugins
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 FieldStatsTest < ::Test::Unit::TestCase
6
+
7
+ context "Field stats" 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 '_field_stats', url
14
+ assert_equal Hash.new, params
15
+ assert_nil body
16
+ true
17
+ end.returns(FakeResponse.new)
18
+
19
+ subject.field_stats
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -28,6 +28,13 @@ module Elasticsearch
28
28
  subject.indices.get_template :name => 'foo^bar'
29
29
  end
30
30
 
31
+ should "catch a NotFound exception with the ignore parameter" do
32
+ subject.expects(:perform_request).raises(NotFound)
33
+
34
+ assert_nothing_raised do
35
+ subject.get_template :id => 1, :ignore => 404
36
+ end
37
+ end
31
38
 
32
39
  end
33
40
 
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Elasticsearch
4
+ module Test
5
+ class SearchExistsTest < ::Test::Unit::TestCase
6
+
7
+ context "Search exists" 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 'POST', method
13
+ assert_equal '_search/exists', url
14
+ assert_equal 'foo', params[:q]
15
+ assert_nil body
16
+ true
17
+ end.returns(FakeResponse.new)
18
+
19
+ subject.search_exists :q => 'foo'
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+ 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: 1.0.7
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2015-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -363,6 +363,7 @@ files:
363
363
  - lib/elasticsearch/api/actions/cat/master.rb
364
364
  - lib/elasticsearch/api/actions/cat/nodes.rb
365
365
  - lib/elasticsearch/api/actions/cat/pending_tasks.rb
366
+ - lib/elasticsearch/api/actions/cat/plugins.rb
366
367
  - lib/elasticsearch/api/actions/cat/recovery.rb
367
368
  - lib/elasticsearch/api/actions/cat/segments.rb
368
369
  - lib/elasticsearch/api/actions/cat/shards.rb
@@ -383,6 +384,7 @@ files:
383
384
  - lib/elasticsearch/api/actions/delete_template.rb
384
385
  - lib/elasticsearch/api/actions/exists.rb
385
386
  - lib/elasticsearch/api/actions/explain.rb
387
+ - lib/elasticsearch/api/actions/field_stats.rb
386
388
  - lib/elasticsearch/api/actions/get.rb
387
389
  - lib/elasticsearch/api/actions/get_script.rb
388
390
  - lib/elasticsearch/api/actions/get_source.rb
@@ -443,6 +445,7 @@ files:
443
445
  - lib/elasticsearch/api/actions/put_template.rb
444
446
  - lib/elasticsearch/api/actions/scroll.rb
445
447
  - lib/elasticsearch/api/actions/search.rb
448
+ - lib/elasticsearch/api/actions/search_exists.rb
446
449
  - lib/elasticsearch/api/actions/search_shards.rb
447
450
  - lib/elasticsearch/api/actions/search_template.rb
448
451
  - lib/elasticsearch/api/actions/snapshot/create.rb
@@ -481,6 +484,7 @@ files:
481
484
  - test/unit/cat/master_test.rb
482
485
  - test/unit/cat/nodes_test.rb
483
486
  - test/unit/cat/pending_tasks_test.rb
487
+ - test/unit/cat/plugins_test.rb
484
488
  - test/unit/cat/recovery_test.rb
485
489
  - test/unit/cat/segments_test.rb
486
490
  - test/unit/cat/shards_test.rb
@@ -502,6 +506,7 @@ files:
502
506
  - test/unit/delete_template_test.rb
503
507
  - test/unit/exists_document_test.rb
504
508
  - test/unit/explain_document_test.rb
509
+ - test/unit/field_stats_test.rb
505
510
  - test/unit/get_document_source_test.rb
506
511
  - test/unit/get_document_test.rb
507
512
  - test/unit/get_script_test.rb
@@ -563,6 +568,7 @@ files:
563
568
  - test/unit/put_script_test.rb
564
569
  - test/unit/put_template_test.rb
565
570
  - test/unit/scroll_test.rb
571
+ - test/unit/search_exists_test.rb
566
572
  - test/unit/search_shards_test.rb
567
573
  - test/unit/search_template_test.rb
568
574
  - test/unit/search_test.rb
@@ -629,6 +635,7 @@ test_files:
629
635
  - test/unit/cat/master_test.rb
630
636
  - test/unit/cat/nodes_test.rb
631
637
  - test/unit/cat/pending_tasks_test.rb
638
+ - test/unit/cat/plugins_test.rb
632
639
  - test/unit/cat/recovery_test.rb
633
640
  - test/unit/cat/segments_test.rb
634
641
  - test/unit/cat/shards_test.rb
@@ -650,6 +657,7 @@ test_files:
650
657
  - test/unit/delete_template_test.rb
651
658
  - test/unit/exists_document_test.rb
652
659
  - test/unit/explain_document_test.rb
660
+ - test/unit/field_stats_test.rb
653
661
  - test/unit/get_document_source_test.rb
654
662
  - test/unit/get_document_test.rb
655
663
  - test/unit/get_script_test.rb
@@ -711,6 +719,7 @@ test_files:
711
719
  - test/unit/put_script_test.rb
712
720
  - test/unit/put_template_test.rb
713
721
  - test/unit/scroll_test.rb
722
+ - test/unit/search_exists_test.rb
714
723
  - test/unit/search_shards_test.rb
715
724
  - test/unit/search_template_test.rb
716
725
  - test/unit/search_test.rb