stretcher 1.6.0 → 1.7.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.
- data/README.md +6 -5
- data/lib/stretcher/index_type.rb +7 -0
- data/lib/stretcher/version.rb +1 -1
- data/spec/lib/stretcher_index_type_spec.rb +8 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -93,11 +93,12 @@ Specs may be run with `rake spec`
|
|
93
93
|
|
94
94
|
## Contributors
|
95
95
|
|
96
|
-
* @andrewvc
|
97
|
-
* @psynix
|
98
|
-
* @fmardini
|
99
|
-
* @chatgris
|
100
|
-
* @alpinegizmo
|
96
|
+
* [@andrewvc](https://github.com/andrewvc)
|
97
|
+
* [@psynix](https://github.com/psynix)
|
98
|
+
* [@fmardini](https://github.com/fmardini)
|
99
|
+
* [@chatgris](https://github.com/chatgris)
|
100
|
+
* [@alpinegizmo](https://github.com/alpinegizmo)
|
101
|
+
* [@mcolyer](https://github.com/mcolyer)
|
101
102
|
|
102
103
|
## Contributing
|
103
104
|
|
data/lib/stretcher/index_type.rb
CHANGED
@@ -19,6 +19,13 @@ module Stretcher
|
|
19
19
|
raw ? res : res["_source"]
|
20
20
|
end
|
21
21
|
|
22
|
+
# Explains a query for a specific document
|
23
|
+
def explain(id, query)
|
24
|
+
request(:get, "#{id}/_explain") do |req|
|
25
|
+
req.body = query
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
22
29
|
# Index an item with a specific ID
|
23
30
|
def put(id, source)
|
24
31
|
request(:put, id, source)
|
data/lib/stretcher/version.rb
CHANGED
@@ -53,7 +53,7 @@ describe Stretcher::IndexType do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
describe "put/get/delete" do
|
56
|
+
describe "put/get/delete/explain" do
|
57
57
|
before do
|
58
58
|
@doc = {:message => "hello!"}
|
59
59
|
@put_res = type.put(987, @doc)
|
@@ -83,6 +83,13 @@ describe Stretcher::IndexType do
|
|
83
83
|
res["_source"].message.should == @doc[:message]
|
84
84
|
end
|
85
85
|
|
86
|
+
it "should explain a query" do
|
87
|
+
type.exists?(987).should be_true
|
88
|
+
index.refresh
|
89
|
+
res = type.explain(987, {:query => {:match_all => {}}})
|
90
|
+
res.should have_key('explanation')
|
91
|
+
end
|
92
|
+
|
86
93
|
it "should update individual docs correctly" do
|
87
94
|
type.update(987, :script => "ctx._source.message = 'Updated!'")
|
88
95
|
type.get(987).message.should == 'Updated!'
|
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.7.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-03-
|
12
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|