elasticsearch-api 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGQwODMzZmNlYjgzMjE4OTQ4OGI4ZGIzM2VkYTA1NjAyZTYwZDI3ZQ==
4
+ NGU5ZjdkZWQ4MmQ3NDhiMzhmY2VjYjE4ZTk3N2NhNDkwMGJhOGMzMw==
5
5
  data.tar.gz: !binary |-
6
- ZjY0YzIzZWUyOTA3YjFkYjFhZjc5NjNlN2UwMWM2NmFhZDViNzZkYw==
6
+ NWRmOGJjYTZlZDY3Zjk5ZWQ0NmFlOTI1M2NjNzczMzY2NDRkNWI3Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmQyYmNiYzI0ODI4MzFiYmExZDU3Njc1ZmVlOGNmMTZkNGUxMWJjNzE3Yzhi
10
- ZjllODY2OTAzMjViZDBhZGJkYjU5OGRjNWNhYmE1NzYwM2JlNmM4NDZkZDRl
11
- YmVhZDM0MmJkNjhmMzU2MjBlZmYyNjBjMTdmOGQ0NWI3YWRlY2M=
9
+ NDc5ZDcxNzhiNjJjNzcwNWQyZjEwMmFmMWY1NzA3OWUyNWVlNGYyNjRmMGEz
10
+ MGI5ZTQwZTI2OGJmNGJlNzQzZTY0ZTdjNTM0ZWU4MzI4NTJjNzkzOTA3N2My
11
+ YjI5MzAxMTlhOTg1OGFiMTZlZGU1Mzk5MDQ2MWRmMTI3YmFjOGU=
12
12
  data.tar.gz: !binary |-
13
- ZDA5NzA2MjI5MDE1YjE1M2RlYzBjNmM0NTA2MDRjMzlmMTkwODA2M2MwNzc3
14
- YjgyM2NkMDZjZTIxZDY2ODIxNzg5NDk3ZjczMDY0Yjg2ZDFhYzIyODI5OTgz
15
- ZjcxNmQ3MTg0NTI3NzRjNjVhYTQ3MjYxYjYxODIwZTQ4NDg1Yzg=
13
+ YzZjODYyMWU1YTgxMmEwYTc3NDdjMjA3YWMyOGUyOGM0ZDE3ZDZjNTdiNmZh
14
+ OWM4NjA4MTE4ZmU5ZDdiMmUyYzY4NzBhMzlmMjRiYzExMTc4YTQ0MDNiYWRj
15
+ OGE4ZWZjNGMwNjY0YzYwMDI1OTFiZDAzNWU5NmNmZjUzYzgxZTk=
@@ -9,6 +9,10 @@ module Elasticsearch
9
9
  #
10
10
  # client.indices.delete_template name: 'mytemplate'
11
11
  #
12
+ # @example Delete all templates
13
+ #
14
+ # client.indices.delete_template name: '*'
15
+ #
12
16
  # @option arguments [String] :name The name of the template (*Required*)
13
17
  # @option arguments [Time] :timeout Explicit operation timeout
14
18
  #
@@ -12,16 +12,19 @@ module Elasticsearch
12
12
  #
13
13
  # @option arguments [String] :name The name of the template (*Required*)
14
14
  # @option arguments [Hash] :body The template definition (*Required*)
15
+ # @option arguments [Boolean] :create Whether the index template should only be added for a new one, # or can also replace an existing one (default: false)
15
16
  # @option arguments [Number] :order The order for this template when merging multiple matching ones
16
17
  # (higher numbers are merged later, overriding the lower numbers)
17
18
  # @option arguments [Time] :timeout Explicit operation timeout
19
+ # @option arguments [Time] :master_timeout Specify timeout for connection to master
20
+ # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
18
21
  #
19
22
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/
20
23
  #
21
24
  def put_template(arguments={})
22
25
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
23
26
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
24
- valid_params = [ :order, :timeout ]
27
+ valid_params = [ :create, :order, :timeout ]
25
28
 
26
29
  method = 'PUT'
27
30
  path = Utils.__pathify '_template', Utils.__escape(arguments[:name])
@@ -48,8 +48,14 @@ module Elasticsearch
48
48
  # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
49
49
  # to perform the operation on all indices
50
50
  # @option arguments [Boolean] :indexing Return information about indexing operations
51
+ # @option arguments [String] :level Return stats aggregated at cluster, index or shard level
52
+ # (Options: cluster, indices, shards)
51
53
  # @option arguments [List] :types A comma-separated list of document types to include in the `indexing` info
52
54
  # @option arguments [Boolean] :merge Return information about merge operations
55
+ # @option arguments [List] :metric Limit the information returned the specific metrics
56
+ # (_all, completion, docs, fielddata, filter_cache, flush, get,
57
+ # id_cache, indexing, merge, percolate, refresh, search, segments,
58
+ # store, warmer, suggest)
53
59
  # @option arguments [Boolean] :refresh Return information about refresh operations
54
60
  # @option arguments [Boolean] :search Return information about search operations; use the `groups` parameter to
55
61
  # include information for specific search groups
@@ -76,6 +82,7 @@ module Elasticsearch
76
82
  :get,
77
83
  :indexing,
78
84
  :merge,
85
+ :metric,
79
86
  :refresh,
80
87
  :search,
81
88
  :suggest,
@@ -87,6 +94,7 @@ module Elasticsearch
87
94
  :completion_fields,
88
95
  :fielddata_fields,
89
96
  :groups,
97
+ :level,
90
98
  :types,
91
99
  :ignore_indices,
92
100
  :ignore_unavailable,
@@ -67,6 +67,8 @@ module Elasticsearch
67
67
  # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are
68
68
  # open, closed or both. (options: open, closed)
69
69
  # @option arguments [String] :percolate_index The index to percolate the document into. Defaults to passed `index`.
70
+ # @option arguments [String] :percolate_format Return an array of matching query IDs instead of objects.
71
+ # (options: ids)
70
72
  # @option arguments [String] :percolate_type The type to percolate document into. Defaults to passed `type`.
71
73
  # @option arguments [Number] :version Explicit version number for concurrency control
72
74
  # @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
@@ -85,6 +87,7 @@ module Elasticsearch
85
87
  :expand_wildcards,
86
88
  :percolate_index,
87
89
  :percolate_type,
90
+ :percolate_format,
88
91
  :version,
89
92
  :version_type ]
90
93
 
@@ -147,7 +147,12 @@ module Elasticsearch
147
147
  # @api private
148
148
  #
149
149
  def __extract_parts(arguments, valid_parts=[])
150
- parts = arguments.keys.select { |a| valid_parts.include?(a) }.map { |a| a.to_s }.sort
150
+ # require 'pry'; binding.pry;
151
+ # parts = arguments.keys.select { |a| valid_parts.include?(a) }.map { |a| a.to_s }.sort
152
+
153
+ parts = Hash[arguments.select { |k,v| valid_parts.include?(k) }]
154
+ parts = parts.reduce([]) { |sum, item| k, v = item; v.is_a?(TrueClass) ? sum << k.to_s : sum << v }
155
+
151
156
  arguments.delete_if { |k,v| valid_parts.include? k }
152
157
  return parts
153
158
  end
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
@@ -218,6 +218,7 @@ module Elasticsearch
218
218
 
219
219
  def skip?(actions)
220
220
  skip = actions.select { |a| a['skip'] }.first
221
+ $stderr.puts "SKIP: #{skip.inspect}" if ENV['DEBUG']
221
222
 
222
223
  # Skip version
223
224
  if skip && skip['skip']['version']
@@ -273,6 +274,7 @@ suites.each do |suite|
273
274
  #
274
275
  setup do
275
276
  $client.indices.delete index: '_all'
277
+ $client.indices.delete_template name: '*'
276
278
  $results = {}
277
279
  $stash = {}
278
280
  end
@@ -40,7 +40,7 @@ module Elasticsearch
40
40
 
41
41
  should "properly pass URL parts" do
42
42
  subject.expects(:perform_request).with do |method, url, params, body|
43
- assert_equal '_nodes/http,jvm', url
43
+ assert_same_elements ['http','jvm'], url.split('/').last.split(',')
44
44
  assert_nil params[:jvm]
45
45
  assert_nil params[:http]
46
46
  true
@@ -168,8 +168,12 @@ module Elasticsearch
168
168
 
169
169
  context "__extract_parts" do
170
170
 
171
- should "extract valid parts from a Hash" do
172
- assert_equal( ['foo'], __extract_parts({ :foo => 'qux' }, [:foo, :bar]) )
171
+ should "extract parts with true value from a Hash" do
172
+ assert_equal( ['foo'], __extract_parts({ :foo => true, :moo => 'blah' }, [:foo, :bar]) )
173
+ end
174
+
175
+ should "extract parts with string value from a Hash" do
176
+ assert_equal( ['qux'], __extract_parts({ :foo => 'qux', :moo => 'blah' }, [:foo, :bar]) )
173
177
  end
174
178
 
175
179
  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.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-22 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json