stretcher 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stretcher/index_type.rb +8 -0
- data/lib/stretcher/version.rb +1 -1
- data/spec/lib/stretcher_index_type_spec.rb +16 -0
- metadata +2 -2
data/lib/stretcher/index_type.rb
CHANGED
@@ -23,6 +23,14 @@ module Stretcher
|
|
23
23
|
raw ? res : res["_source"]
|
24
24
|
end
|
25
25
|
|
26
|
+
# Retrieves multiple documents of the index type by ID
|
27
|
+
# http://www.elasticsearch.org/guide/reference/api/multi-get/
|
28
|
+
def mget(ids)
|
29
|
+
request(:get, '_mget') do |req|
|
30
|
+
req.body = {ids: ids}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
26
34
|
# Explains a query for a specific document
|
27
35
|
def explain(id, query)
|
28
36
|
request(:get, "#{id}/_explain") do |req|
|
data/lib/stretcher/version.rb
CHANGED
@@ -53,6 +53,22 @@ describe Stretcher::IndexType do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
describe 'mget' do
|
57
|
+
let(:doc_one) {{:message => "message one!", :_timestamp => 1366420402}}
|
58
|
+
let(:doc_two) {{:message => "message two!", :_timestamp => 1366420403}}
|
59
|
+
|
60
|
+
before do
|
61
|
+
type.put(988, doc_one)
|
62
|
+
type.put(989, doc_two)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'fetches multiple documents by id' do
|
66
|
+
type.mget([988, 989]).docs.count.should == 2
|
67
|
+
type.mget([988, 989]).docs.first._source.message.should == 'message one!'
|
68
|
+
type.mget([988, 989]).docs.last._source.message.should == 'message two!'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
56
72
|
describe "put/get/delete/explain" do
|
57
73
|
before do
|
58
74
|
@doc = {:message => "hello!", :_timestamp => 1366420401}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stretcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|