elastomer-client 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +0 -4
  4. data/CHANGELOG.md +8 -0
  5. data/docker/docker-compose.cibuild.yml +8 -0
  6. data/docker/docker-compose.es24.yml +34 -0
  7. data/docker/docker-compose.es56.yml +37 -0
  8. data/docker/elasticsearch.yml +15 -0
  9. data/docs/index.md +2 -2
  10. data/docs/notifications.md +1 -1
  11. data/elastomer-client.gemspec +2 -0
  12. data/lib/elastomer/client.rb +86 -33
  13. data/lib/elastomer/client/app_delete_by_query.rb +158 -0
  14. data/lib/elastomer/client/delete_by_query.rb +8 -115
  15. data/lib/elastomer/client/docs.rb +63 -13
  16. data/lib/elastomer/client/errors.rb +10 -2
  17. data/lib/elastomer/client/index.rb +40 -12
  18. data/lib/elastomer/client/multi_percolate.rb +2 -2
  19. data/lib/elastomer/client/native_delete_by_query.rb +60 -0
  20. data/lib/elastomer/client/percolator.rb +6 -3
  21. data/lib/elastomer/client/scroller.rb +22 -7
  22. data/lib/elastomer/client/tasks.rb +188 -0
  23. data/lib/elastomer/client/warmer.rb +6 -0
  24. data/lib/elastomer/notifications.rb +1 -0
  25. data/lib/elastomer/version.rb +1 -1
  26. data/lib/elastomer/version_support.rb +177 -0
  27. data/script/cibuild +77 -6
  28. data/script/cibuild-elastomer-client +1 -0
  29. data/script/cibuild-elastomer-client-es24 +8 -0
  30. data/script/cibuild-elastomer-client-es56 +8 -0
  31. data/script/poll-for-es +20 -0
  32. data/test/client/{delete_by_query_test.rb → app_delete_by_query_test.rb} +7 -7
  33. data/test/client/bulk_test.rb +9 -13
  34. data/test/client/cluster_test.rb +2 -2
  35. data/test/client/docs_test.rb +133 -49
  36. data/test/client/errors_test.rb +21 -1
  37. data/test/client/es_5_x_warmer_test.rb +13 -0
  38. data/test/client/index_test.rb +104 -39
  39. data/test/client/multi_percolate_test.rb +13 -6
  40. data/test/client/multi_search_test.rb +5 -5
  41. data/test/client/native_delete_by_query_test.rb +123 -0
  42. data/test/client/nodes_test.rb +1 -1
  43. data/test/client/percolator_test.rb +10 -2
  44. data/test/client/repository_test.rb +1 -1
  45. data/test/client/scroller_test.rb +16 -6
  46. data/test/client/snapshot_test.rb +1 -1
  47. data/test/client/stubbed_client_test.rb +1 -1
  48. data/test/client/tasks_test.rb +139 -0
  49. data/test/client/template_test.rb +1 -1
  50. data/test/client/warmer_test.rb +8 -4
  51. data/test/client_test.rb +99 -0
  52. data/test/core_ext/time_test.rb +1 -1
  53. data/test/notifications_test.rb +4 -0
  54. data/test/test_helper.rb +129 -21
  55. data/test/version_support_test.rb +119 -0
  56. metadata +59 -5
@@ -1,30 +1,101 @@
1
- #!/bin/sh
1
+ #!/bin/bash
2
2
  # Usage: script/cibuild
3
- # CI build script.
3
+ # CI build script
4
4
  # This is tailored for the janky build machines.
5
- set -e
5
+
6
+ set -ue
7
+
8
+ # Only echo the tags when in CI_MODE
9
+ begin_fold() {
10
+ local tag="$1"
11
+ if [ "${CI_MODE:-}" ]; then
12
+ echo "%%%FOLD {${tag}}%%%"
13
+ fi
14
+ }
15
+
16
+ # Only echo the tags when in CI_MODE
17
+ end_fold() {
18
+ if [ "${CI_MODE:-}" ]; then
19
+ echo "%%%END FOLD%%%"
20
+ fi
21
+ }
22
+
23
+ function cleanup() {
24
+ echo
25
+ begin_fold "Shutting down services..."
26
+ $docker_compose down -v
27
+ end_fold
28
+ }
29
+
30
+ # Borrowed from script/bintools in github/ci
31
+ output_fold() {
32
+ # Exit early if no label provided
33
+ if [ -z "$1" ]; then
34
+ echo "output_fold(): requires a label argument."
35
+ return
36
+ fi
37
+
38
+ exit_value=0 # exit_value is used to record exit status of the given command
39
+ label=$1 # human-readable label describing what's being folded up
40
+ shift 1 # having retrieved the output_fold()-specific arguments, strip them off $@
41
+
42
+ begin_fold "$label"
43
+
44
+ # run the remaining arguments. If the command exits non-0, the `||` will
45
+ # prevent the `-e` flag from seeing the failure exit code, and we'll see
46
+ # the second echo execute
47
+ "$@" || exit_value=$?
48
+
49
+ end_fold
50
+
51
+ # preserve the exit code from the subcommand.
52
+ return $exit_value
53
+ }
54
+
55
+ trap cleanup EXIT
56
+
57
+ export ES_PORT=${ES_PORT:-19200}
58
+
59
+ es_version=${ES_VERSION:-24}
60
+ docker_compose="docker-compose --file docker/docker-compose.es${es_version}.yml"
61
+
62
+ if [ "${CI_MODE:-}" ]; then
63
+ docker_compose="${docker_compose} --file docker/docker-compose.cibuild.yml"
64
+ # docker_compose="${docker_compose} --no-ansi"
65
+ fi
6
66
 
7
67
  # change into root dir and setup path
8
68
  cd $(dirname "$0")/..
9
69
  PATH="$(pwd)/bin:$(pwd)/script:/usr/share/rbenv/shims:$PATH"
10
70
 
71
+ echo "hostname: $(hostname)"
72
+
11
73
  # Write commit we're building at
12
- git log -n 1 || true
74
+ output_fold "Commit info..." git log -n 1 || true
75
+ echo
76
+
77
+ output_fold "Bootstrapping container..." $docker_compose build
78
+ output_fold "Bringing up services..." $docker_compose up -d
79
+ output_fold "Waiting for Elasticsearch..." script/poll-for-es
13
80
  echo
14
81
 
15
82
  result=0
16
83
 
84
+ begin_fold "Ruby environment setup..."
17
85
  export RBENV_VERSION="2.3.3"
18
86
  if [ -d /usr/share/rbenv/shims ]; then
19
- export PATH=/usr/share/rbenv/shims:$PATH
87
+ export PATH=/usr/share/rbenv/shims:$PATH
20
88
  fi
21
89
  ruby -v
22
90
  rm -f Gemfile.lock
23
91
  script/bootstrap
92
+ end_fold
93
+ echo
94
+
24
95
  bundle exec rake test || result=$?
25
96
 
26
97
  if [ $result -ne 0 ]; then
27
- exit $result
98
+ exit $result
28
99
  fi
29
100
 
30
101
  # echo
@@ -0,0 +1 @@
1
+ script/cibuild-elastomer-client-es24
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ # Usage: script/cibuild-es24
3
+ # CI build script targeting Elasticsearch 2.4
4
+
5
+ export ES_VERSION=24
6
+ export CI_MODE=true
7
+
8
+ script/cibuild
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ # Usage: script/cibuild-es56
3
+ # CI build script targeting Elasticsearch 5.6
4
+
5
+ export ES_VERSION=56
6
+ export CI_MODE=true
7
+
8
+ script/cibuild
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+ #
3
+ # This script will poll the Elasticsearch health endpoint until the cluster
4
+ # reaches a yellow state which is good enough for testing. This script will poll
5
+ # for up to 30 seconds waiting for Elasticsearch to start. It will give up at
6
+ # that time and return a non-zero exit code.
7
+
8
+ es_port=${ES_PORT:-9200}
9
+ count=0
10
+
11
+ until $(curl -s "localhost:${es_port}/_cluster/health?wait_for_status=yellow&timeout=30s" > /dev/null 2>&1); do
12
+ sleep 0.50
13
+ count=$(($count+1))
14
+ if [ "$count" -gt 60 ]; then
15
+ echo "Timed out waiting for Elasticsearch at localhost:${es_port}"
16
+ exit 1
17
+ fi
18
+ done
19
+
20
+ echo "Elasticsearch is ready at localhost:${es_port}"
@@ -1,6 +1,6 @@
1
- require File.expand_path("../../test_helper", __FILE__)
1
+ require_relative "../test_helper"
2
2
 
3
- describe Elastomer::Client::DeleteByQuery do
3
+ describe Elastomer::Client::AppDeleteByQuery do
4
4
 
5
5
  before do
6
6
  @index = $client.index "elastomer-delete-by-query-test"
@@ -23,7 +23,7 @@ describe Elastomer::Client::DeleteByQuery do
23
23
  @docs.index({ :_id => 1, :name => "luna" })
24
24
 
25
25
  @index.refresh
26
- response = @index.delete_by_query(nil, :q => "name:mittens")
26
+ response = @index.app_delete_by_query(nil, :q => "name:mittens")
27
27
  assert_equal({
28
28
  "_all" => {
29
29
  "found" => 1,
@@ -50,7 +50,7 @@ describe Elastomer::Client::DeleteByQuery do
50
50
  @docs.index({ :_id => 1, :name => "luna" })
51
51
  @index.refresh
52
52
 
53
- response = @index.delete_by_query(nil, :action_count => 1)
53
+ response = @index.app_delete_by_query(nil, :action_count => 1)
54
54
 
55
55
  assert_requested(:post, /_bulk/, :times => 2)
56
56
 
@@ -95,7 +95,7 @@ describe Elastomer::Client::DeleteByQuery do
95
95
  end)
96
96
 
97
97
  @index.refresh
98
- response = @index.delete_by_query(nil, :action_count => 1)
98
+ response = @index.app_delete_by_query(nil, :action_count => 1)
99
99
  assert_equal({
100
100
  "_all" => {
101
101
  "found" => 0,
@@ -131,7 +131,7 @@ describe Elastomer::Client::DeleteByQuery do
131
131
  end)
132
132
 
133
133
  @index.refresh
134
- response = @index.delete_by_query(nil, :action_count => 1)
134
+ response = @index.app_delete_by_query(nil, :action_count => 1)
135
135
  assert_equal({
136
136
  "_all" => {
137
137
  "found" => 1,
@@ -160,7 +160,7 @@ describe Elastomer::Client::DeleteByQuery do
160
160
  docs.index({ :_id => 1, :_routing => "cat", :name => "luna" })
161
161
 
162
162
  index.refresh
163
- response = index.delete_by_query(nil, :q => "name:mittens")
163
+ response = index.app_delete_by_query(nil, :q => "name:mittens")
164
164
  assert_equal({
165
165
  "_all" => {
166
166
  "found" => 1,
@@ -1,4 +1,4 @@
1
- require File.expand_path("../../test_helper", __FILE__)
1
+ require_relative "../test_helper"
2
2
 
3
3
  describe Elastomer::Client::Bulk do
4
4
 
@@ -13,15 +13,15 @@ describe Elastomer::Client::Bulk do
13
13
  :tweet => {
14
14
  :_source => { :enabled => true }, :_all => { :enabled => false },
15
15
  :properties => {
16
- :message => { :type => "string", :analyzer => "standard" },
17
- :author => { :type => "string", :index => "not_analyzed" }
16
+ :message => $client.version_support.text(analyzer: "standard"),
17
+ :author => $client.version_support.keyword
18
18
  }
19
19
  },
20
20
  :book => {
21
21
  :_source => { :enabled => true }, :_all => { :enabled => false },
22
22
  :properties => {
23
- :title => { :type => "string", :analyzer => "standard" },
24
- :author => { :type => "string", :index => "not_analyzed" }
23
+ :title => $client.version_support.text(analyzer: "standard"),
24
+ :author => $client.version_support.keyword
25
25
  }
26
26
  }
27
27
  }
@@ -89,16 +89,14 @@ describe Elastomer::Client::Bulk do
89
89
 
90
90
  assert_equal 2, h["items"].length
91
91
 
92
- if es_version_2_x?
92
+ if bulk_index_returns_create_for_new_documents?
93
93
  assert_bulk_index h["items"].first
94
94
  assert_bulk_create h["items"].last
95
95
  book_id = items.last["create"]["_id"]
96
- elsif es_version_5_x?
96
+ else
97
97
  assert_bulk_index h["items"].first
98
98
  assert_bulk_index h["items"].last
99
99
  book_id = items.last["index"]["_id"]
100
- else
101
- fail "Unknown ES version!"
102
100
  end
103
101
 
104
102
  assert_match %r/^\S{20,22}$/, book_id
@@ -120,18 +118,16 @@ describe Elastomer::Client::Bulk do
120
118
 
121
119
  assert_equal 2, h["items"].length
122
120
 
123
- if es_version_2_x?
121
+ if bulk_index_returns_create_for_new_documents?
124
122
  assert_bulk_create h["items"].first, "expected to create a book"
125
123
  assert_bulk_delete h["items"].last, "expected to delete a book"
126
124
 
127
125
  book_id2 = items.first["create"]["_id"]
128
- elsif es_version_5_x?
126
+ else
129
127
  assert_bulk_index h["items"].first, "expected to create a book"
130
128
  assert_bulk_delete h["items"].last, "expected to delete a book"
131
129
 
132
130
  book_id2 = items.first["index"]["_id"]
133
- else
134
- fail "Unknown ES version!"
135
131
  end
136
132
 
137
133
  assert_match %r/^\S{20,22}$/, book_id2
@@ -1,4 +1,4 @@
1
- require File.expand_path("../../test_helper", __FILE__)
1
+ require_relative "../test_helper"
2
2
 
3
3
  describe Elastomer::Client::Cluster do
4
4
 
@@ -69,7 +69,7 @@ describe Elastomer::Client::Cluster do
69
69
  it "returns cluster stats" do
70
70
  h = @cluster.stats
71
71
  expected = %w[cluster_name indices nodes status timestamp]
72
- expected.unshift("_nodes") if es_version_5_x?
72
+ expected.unshift("_nodes") if cluster_stats_includes_underscore_nodes?
73
73
  assert_equal expected, h.keys.sort
74
74
  end
75
75
 
@@ -1,4 +1,4 @@
1
- require File.expand_path("../../test_helper", __FILE__)
1
+ require_relative "../test_helper"
2
2
 
3
3
  describe Elastomer::Client::Docs do
4
4
 
@@ -13,19 +13,24 @@ describe Elastomer::Client::Docs do
13
13
  :doc1 => {
14
14
  :_source => { :enabled => true }, :_all => { :enabled => false },
15
15
  :properties => {
16
- :title => { :type => "string", :analyzer => "standard", :term_vector => "with_positions_offsets" },
17
- :author => { :type => "string", :index => "not_analyzed" }
16
+ :title => $client.version_support.text(analyzer: "standard", term_vector: "with_positions_offsets"),
17
+ :author => $client.version_support.keyword
18
18
  }
19
19
  },
20
20
  :doc2 => {
21
21
  :_source => { :enabled => true }, :_all => { :enabled => false },
22
22
  :properties => {
23
- :title => { :type => "string", :analyzer => "standard", :term_vector => "with_positions_offsets" },
24
- :author => { :type => "string", :index => "not_analyzed" }
23
+ :title => $client.version_support.text(analyzer: "standard", term_vector: "with_positions_offsets"),
24
+ :author => $client.version_support.keyword
25
25
  }
26
26
  }
27
27
  }
28
28
 
29
+ # COMPATIBILITY
30
+ if requires_percolator_mapping?
31
+ @index.update_mapping("percolator", { :properties => { :query => { :type => "percolator"}}})
32
+ end
33
+
29
34
  wait_for_index(@name)
30
35
  end
31
36
 
@@ -92,26 +97,81 @@ describe Elastomer::Client::Docs do
92
97
  assert_match %r/^\S{20,22}$/, h["_id"]
93
98
  end
94
99
 
95
- it "extracts underscore attributes from the document" do
96
- doc = {
97
- :_id => "12",
98
- :_type => "doc2",
99
- :_routing => "author",
100
- "_consistency" => "all",
101
- :title => "The Adventures of Huckleberry Finn",
102
- :author => "Mark Twain",
103
- :_unknown => "unknown attribute"
104
- }
100
+ describe "indexing directive fields" do
101
+ it "indexes fields that are not recognized as indexing directives" do
102
+ doc = {
103
+ _id: "12",
104
+ _type: "doc2",
105
+ title: "The Adventures of Huckleberry Finn",
106
+ author: "Mark Twain",
107
+ _unknown_1: "unknown attribute 1",
108
+ "_unknown_2" => "unknown attribute 2"
109
+ }
105
110
 
106
- h = @docs.index doc
107
- assert_created h
108
- assert_equal "12", h["_id"]
111
+ h = @docs.index(doc)
112
+ assert_created h
113
+ assert_equal "12", h["_id"]
114
+
115
+ indexed_doc = @docs.get(type: "doc2", id: "12")
116
+ expected = {
117
+ "title" => "The Adventures of Huckleberry Finn",
118
+ "author" => "Mark Twain",
119
+ "_unknown_1" => "unknown attribute 1",
120
+ "_unknown_2" => "unknown attribute 2"
121
+ }
122
+ assert_equal expected, indexed_doc["_source"]
123
+ end
124
+
125
+ it "extracts indexing directives from the document" do
126
+ doc = {
127
+ _id: "12",
128
+ "_type" => "doc2",
129
+ _routing: "author",
130
+ title: "The Adventures of Huckleberry Finn",
131
+ author: "Mark Twain"
132
+ }
133
+
134
+ h = @docs.index(doc)
135
+ assert_created h
136
+ assert_equal "12", h["_id"]
137
+
138
+ # Special keys are removed from the document hash
139
+ refute doc.key?(:_id)
140
+ refute doc.key?("_type")
141
+ refute doc.key?(:_routing)
142
+
143
+ indexed_doc = @docs.get(type: "doc2", id: "12")
144
+ expected = {
145
+ "title" => "The Adventures of Huckleberry Finn",
146
+ "author" => "Mark Twain",
147
+ }
148
+ assert_equal expected, indexed_doc["_source"]
149
+ end
109
150
 
110
- refute doc.key?(:_id)
111
- refute doc.key?(:_type)
112
- refute doc.key?(:_routing)
113
- refute doc.key?("_consistency")
114
- assert doc.key?(:_unknown)
151
+ # COMPATIBILITY: Fail fast on known indexing directives that aren't for this version of ES
152
+ it "raises an exception when a known indexing directive from an unsupported version is used" do
153
+ # Symbol keys
154
+ doc = {
155
+ _id: "12",
156
+ _type: "doc2",
157
+ title: "The Adventures of Huckleberry Finn"
158
+ }.merge(incompatible_indexing_directive)
159
+
160
+ assert_raises(Elastomer::Client::IllegalArgument) do
161
+ @docs.index(doc)
162
+ end
163
+
164
+ # String keys
165
+ doc = {
166
+ "_id" => "12",
167
+ "_type" => "doc2",
168
+ "title" => "The Adventures of Huckleberry Finn"
169
+ }.merge(incompatible_indexing_directive.stringify_keys)
170
+
171
+ assert_raises(Elastomer::Client::IllegalArgument) do
172
+ @docs.index(doc)
173
+ end
174
+ end
115
175
  end
116
176
 
117
177
  it "gets documents from the search index" do
@@ -214,33 +274,38 @@ describe Elastomer::Client::Docs do
214
274
  assert_equal %w[pea53 grantr], authors
215
275
 
216
276
  h = @docs.delete_by_query(:q => "author:grantr")
217
- assert_equal(h["_indices"], {
218
- "_all" => {
219
- "found" => 1,
220
- "deleted" => 1,
221
- "missing" => 0,
222
- "failed" => 0,
223
- },
224
- @name => {
225
- "found" => 1,
226
- "deleted" => 1,
227
- "missing" => 0,
228
- "failed" => 0,
229
- },
230
- })
277
+
278
+ if supports_native_delete_by_query?
279
+ assert_equal(1, h["deleted"])
280
+ else
281
+ assert_equal(h["_indices"], {
282
+ "_all" => {
283
+ "found" => 1,
284
+ "deleted" => 1,
285
+ "missing" => 0,
286
+ "failed" => 0,
287
+ },
288
+ @name => {
289
+ "found" => 1,
290
+ "deleted" => 1,
291
+ "missing" => 0,
292
+ "failed" => 0,
293
+ },
294
+ })
295
+ end
296
+
231
297
  @index.refresh
232
298
  h = @docs.multi_get :ids => [1, 2]
233
299
  assert_found h["docs"][0]
234
300
  refute_found h["docs"][1]
235
301
 
236
302
  h = @docs.delete_by_query(
237
- :query => {
238
- :filtered => {
239
- :query => {:match_all => {}},
240
- :filter => {:term => {:author => "pea53"}}
241
- }
242
- }
243
- )
303
+ :query => {
304
+ :bool => {
305
+ :filter => {:term => {:author => "pea53"}}
306
+ }
307
+ }
308
+ )
244
309
  @index.refresh
245
310
  h = @docs.multi_get :ids => [1, 2]
246
311
  refute_found h["docs"][0]
@@ -261,7 +326,7 @@ describe Elastomer::Client::Docs do
261
326
 
262
327
  h = @docs.search({
263
328
  :query => {:match_all => {}},
264
- :filter => {:term => {:author => "defunkt"}}
329
+ :post_filter => {:term => {:author => "defunkt"}}
265
330
  }, :type => %w[doc1 doc2] )
266
331
  assert_equal 1, h["hits"]["total"]
267
332
 
@@ -302,8 +367,7 @@ describe Elastomer::Client::Docs do
302
367
 
303
368
  h = @docs.count({
304
369
  :query => {
305
- :filtered => {
306
- :query => {:match_all => {}},
370
+ :bool => {
307
371
  :filter => {:term => {:author => "defunkt"}}
308
372
  }
309
373
  }
@@ -340,8 +404,23 @@ describe Elastomer::Client::Docs do
340
404
  :filter => {:term => {:author => "defunkt"}}
341
405
  }
342
406
  }
343
- }, :type => %w[doc1 doc2] )
344
- assert_equal true, h["valid"]
407
+ }, :type => %w[doc1 doc2])
408
+
409
+ if filtered_query_removed?
410
+ refute h["valid"]
411
+ else
412
+ assert h["valid"]
413
+ end
414
+
415
+ h = @docs.validate({
416
+ :query => {
417
+ :bool => {
418
+ :filter => {:term => {:author => "defunkt"}}
419
+ }
420
+ }
421
+ }, :type => %w[doc1 doc2])
422
+
423
+ assert h["valid"]
345
424
  end
346
425
 
347
426
  it "updates documents" do
@@ -463,6 +542,7 @@ describe Elastomer::Client::Docs do
463
542
  percolator2 = @index.percolator "2"
464
543
  response = percolator2.create :query => { :match => { :author => "defunkt" } }
465
544
  assert response["created"], "Couldn't create the percolator query"
545
+ @index.refresh
466
546
 
467
547
  response = @index.docs("doc1").percolate(:doc => { :author => "pea53" })
468
548
  assert_equal 1, response["matches"].length
@@ -478,6 +558,7 @@ describe Elastomer::Client::Docs do
478
558
  percolator2 = @index.percolator "2"
479
559
  response = percolator2.create :query => { :match => { :author => "defunkt" } }
480
560
  assert response["created"], "Couldn't create the percolator query"
561
+ @index.refresh
481
562
 
482
563
  response = @index.docs("doc2").percolate(nil, :id => "1")
483
564
  assert_equal 1, response["matches"].length
@@ -493,6 +574,7 @@ describe Elastomer::Client::Docs do
493
574
  percolator2 = @index.percolator "2"
494
575
  response = percolator2.create :query => { :match => { :author => "defunkt" } }
495
576
  assert response["created"], "Couldn't create the percolator query"
577
+ @index.refresh
496
578
 
497
579
  count = @index.docs("doc1").percolate_count :doc => { :author => "pea53" }
498
580
  assert_equal 1, count
@@ -507,6 +589,7 @@ describe Elastomer::Client::Docs do
507
589
  percolator2 = @index.percolator "2"
508
590
  response = percolator2.create :query => { :match => { :author => "defunkt" } }
509
591
  assert response["created"], "Couldn't create the percolator query"
592
+ @index.refresh
510
593
 
511
594
  count = @index.docs("doc2").percolate_count(nil, :id => "1")
512
595
  assert_equal 1, count
@@ -515,6 +598,7 @@ describe Elastomer::Client::Docs do
515
598
  it "performs multi percolate queries" do
516
599
  @index.percolator("1").create :query => { :match_all => { } }
517
600
  @index.percolator("2").create :query => { :match => { :author => "pea53" } }
601
+ @index.refresh
518
602
 
519
603
  h = @index.docs("doc2").multi_percolate do |m|
520
604
  m.percolate :author => "pea53"