stretcher 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/stretcher/server.rb +4 -2
- data/lib/stretcher/version.rb +1 -1
- data/spec/lib/stretcher_index_spec.rb +6 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -29,7 +29,7 @@ server = Stretcher::Server.new('http://localhost:9200')
|
|
29
29
|
# Delete an index (in case you already have this one)
|
30
30
|
server.index(:foo).delete rescue nil
|
31
31
|
# Create an index
|
32
|
-
server.index(:foo).create(
|
32
|
+
server.index(:foo).create(mappings: {tweet: {properties: {text: 'string'}}})
|
33
33
|
# Add a document
|
34
34
|
server.index(:foo).type(:tweet).put(123, {text: 'Hello'})
|
35
35
|
# Retrieve a document
|
data/lib/stretcher/server.rb
CHANGED
@@ -83,8 +83,10 @@ module Stretcher
|
|
83
83
|
req.body = fmt_body
|
84
84
|
}
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
errors = res.responses.select {|r| r[:error]}.map(&:error)
|
87
|
+
if !errors.empty?
|
88
|
+
raise RequestError.new(res), "Could not msearch #{errors.inspect}"
|
89
|
+
end
|
88
90
|
|
89
91
|
res['responses'].map {|r| SearchResults.new(raw: r)}
|
90
92
|
end
|
data/lib/stretcher/version.rb
CHANGED
@@ -64,4 +64,10 @@ describe Stretcher::Index do
|
|
64
64
|
res.length.should == 1
|
65
65
|
res[0].class.should == Stretcher::SearchResults
|
66
66
|
end
|
67
|
+
|
68
|
+
it "should raise an exception when msearching a non-existant index" do
|
69
|
+
lambda {
|
70
|
+
res = server.index(:does_not_exist).msearch([{query: {match_all: {}}}])
|
71
|
+
}.should raise_exception(Stretcher::RequestError)
|
72
|
+
end
|
67
73
|
end
|
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.1.
|
4
|
+
version: 1.1.3
|
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-01-
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|