elastomer-client 2.0.0 → 2.0.1

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: d77143e192594473f269fc69f9b6552dd7c5b3d8
4
- data.tar.gz: aa71ccdf91b2a0277b61595bcd2b34409c3bd02b
3
+ metadata.gz: ffa99916d4477ed77f1e67b038ddc8de6c70dcf4
4
+ data.tar.gz: 5700c42af44a02684b86d29d9381cdcacd0aaf50
5
5
  SHA512:
6
- metadata.gz: b7cb2962c8cdc9712989d9c2e127147e1126ca4f4dcca825c55b4a8f496626f01b236fd59097cb119f031849858f7f1acbe8eda4258e3f9dfa7d7e924533c011
7
- data.tar.gz: d780635a018e9d178d28e279ee1051be21ecd522f6db0edcdb88ef53fbef49dc2b2de58433b9b96a1bb13fb773177830487a0f7bbc3e2cd439eb511af6e56268
6
+ metadata.gz: 6f73679c1b09cafca5499fb515795025528b194cc0794aac1ecdcac2d3a084fa69c7f08f89837de61ecaea1d75d48f9e668d5df15351b8eaa9c8c7246a412f29
7
+ data.tar.gz: 169c324aac607fd8e3531a2c07aa8191df935390e603d8f7498fec3b093cc2a7a039df6e5280d9bf92018a2dc0e7723a97f02408bb9c90aad3abc88ee90989f9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.0.1 (2016-09-01)
2
+ - Fix bug in delete by query when routing is required
3
+
4
+ ## 2.0.0 (2016-08-25)
5
+ - Support Elasticsearch 2
6
+
1
7
  ## 0.9.0 (2016-02-26)
2
8
  - Adding support for the `/_suggest` API endpoint
3
9
  - Documentation cleanup - thank you Matt Wagner @wags
@@ -106,7 +106,7 @@ module Elastomer
106
106
  def execute
107
107
  ops = Enumerator.new do |yielder|
108
108
  @client.scan(@query, @params.merge(:_source => false)).each_document do |hit|
109
- yielder.yield([:delete, { :_id => hit["_id"], :_type => hit["_type"], :_index => hit["_index"] }])
109
+ yielder.yield([:delete, hit.select { |key, _| ["_index", "_type", "_id", "_routing"].include?(key) }])
110
110
  end
111
111
  end
112
112
 
@@ -1,5 +1,5 @@
1
1
  module Elastomer
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -147,5 +147,46 @@ describe Elastomer::Client::DeleteByQuery do
147
147
  },
148
148
  }, response["_indices"])
149
149
  end
150
+
151
+ it "deletes by query when routing is specified" do
152
+ index = $client.index "elastomer-delete-by-query-routing-test"
153
+ index.delete if index.exists?
154
+ type = "docs"
155
+ index.create({ :mappings => { type => { :_routing => { :required => true } } } })
156
+ wait_for_index(@index.name)
157
+ docs = index.docs(type)
158
+
159
+ docs.index({ :_id => 0, :_routing => "cat", :name => "mittens" })
160
+ docs.index({ :_id => 1, :_routing => "cat", :name => "luna" })
161
+
162
+ index.refresh
163
+ response = index.delete_by_query(nil, :q => "name:mittens")
164
+ assert_equal({
165
+ "_all" => {
166
+ "found" => 1,
167
+ "deleted" => 1,
168
+ "missing" => 0,
169
+ "failed" => 0,
170
+ },
171
+ index.name => {
172
+ "found" => 1,
173
+ "deleted" => 1,
174
+ "missing" => 0,
175
+ "failed" => 0,
176
+ },
177
+ }, response["_indices"])
178
+
179
+ index.refresh
180
+ response = docs.multi_get({
181
+ :docs => [
182
+ { :_id => 0, :_routing => "cat" },
183
+ { :_id => 1, :_routing => "cat" },
184
+ ]
185
+ })
186
+ refute_found response["docs"][0]
187
+ assert_found response["docs"][1]
188
+
189
+ index.delete if index.exists?
190
+ end
150
191
  end
151
192
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastomer-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-26 00:00:00.000000000 Z
12
+ date: 2016-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  version: '0'
268
268
  requirements: []
269
269
  rubyforge_project:
270
- rubygems_version: 2.2.3
270
+ rubygems_version: 2.2.5
271
271
  signing_key:
272
272
  specification_version: 4
273
273
  summary: A library for interacting with Elasticsearch