stretcher 1.1.2 → 1.1.3

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.
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(mapping: {tweet: {properties: {text: 'string'}}})
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
@@ -83,8 +83,10 @@ module Stretcher
83
83
  req.body = fmt_body
84
84
  }
85
85
 
86
- # Is this necessary?
87
- raise RequestError.new(res), "Could not msearch" if res['error']
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
@@ -1,3 +1,3 @@
1
1
  module Stretcher
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -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.2
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-24 00:00:00.000000000 Z
12
+ date: 2013-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday