rubberband 0.1.0 → 0.1.1
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/Gemfile.lock +1 -1
- data/lib/elasticsearch/client/admin_index.rb +9 -0
- data/lib/elasticsearch/client/index.rb +12 -6
- data/lib/elasticsearch/transport/base_protocol.rb +8 -0
- data/lib/elasticsearch/version.rb +1 -1
- data/spec/admin_spec.rb +5 -1
- data/spec/bulk_spec.rb +17 -0
- metadata +16 -16
data/Gemfile.lock
CHANGED
@@ -69,6 +69,15 @@ module ElasticSearch
|
|
69
69
|
execute(:update_mapping, indices, type, mapping, options)
|
70
70
|
end
|
71
71
|
|
72
|
+
def update_settings(settings, options={})
|
73
|
+
index, type, options = extract_scope(options)
|
74
|
+
execute(:update_settings, index, settings, options)
|
75
|
+
end
|
76
|
+
|
77
|
+
def get_settings(index, options={})
|
78
|
+
execute(:get_settings, index, options)
|
79
|
+
end
|
80
|
+
|
72
81
|
# list of indices, or :all
|
73
82
|
# options: refresh
|
74
83
|
# default: default_index if defined, otherwise :all
|
@@ -114,13 +114,19 @@ module ElasticSearch
|
|
114
114
|
# Starts a bulk operation batch and yields self. Index and delete requests will be
|
115
115
|
# queued until the block closes, then sent as a single _bulk call.
|
116
116
|
def bulk(options={})
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
117
|
+
# allow nested bulk calls
|
118
|
+
if @batch
|
119
|
+
yield(self)
|
120
|
+
else
|
121
|
+
begin
|
122
|
+
@batch = []
|
123
|
+
yield(self)
|
124
|
+
response = execute(:bulk, @batch, options)
|
125
|
+
ensure
|
126
|
+
@batch = nil
|
127
|
+
end
|
128
|
+
end
|
122
129
|
end
|
123
|
-
|
124
130
|
end
|
125
131
|
end
|
126
132
|
end
|
@@ -114,6 +114,14 @@ module ElasticSearch
|
|
114
114
|
standard_request(:get, {:index => index_list, :op => "_mapping"})
|
115
115
|
end
|
116
116
|
|
117
|
+
def update_settings(index, settings, options)
|
118
|
+
standard_request(:put, {:index => index, :op => "_settings"}, options, encoder.encode(settings))
|
119
|
+
end
|
120
|
+
|
121
|
+
def get_settings(index, options)
|
122
|
+
standard_request(:get, {:index => index, :op => "_settings"}, options)
|
123
|
+
end
|
124
|
+
|
117
125
|
def flush(index_list, options={})
|
118
126
|
standard_request(:post, {:index => index_list, :op => "_flush"}, options, "")
|
119
127
|
end
|
data/spec/admin_spec.rb
CHANGED
@@ -14,8 +14,12 @@ describe "basic ops" do
|
|
14
14
|
it "should get and update mappings" do
|
15
15
|
@client.index({:foo => "bar"}, :id => "1", :refresh => true)
|
16
16
|
|
17
|
-
@client.index_mapping(@first_index).should == {@first_index => {"tweet" => { "properties" => { "foo" => {"type" => "string" }}}}}
|
18
17
|
@client.update_mapping({"tweet" => {:properties => {:bar => {:type => "string"}}}})
|
19
18
|
@client.index_mapping(@first_index).should == {@first_index => {"tweet" => { "properties" => { "foo" => {"type" => "string" }, "bar" => { "type" => "string"}}}}}
|
20
19
|
end
|
20
|
+
|
21
|
+
it "should get and update settings" do
|
22
|
+
@client.update_settings("index" => {"refresh_interval" => 30})
|
23
|
+
@client.get_settings(@first_index)[@first_index]["settings"].should include("index.refresh_interval" => "30")
|
24
|
+
end
|
21
25
|
end
|
data/spec/bulk_spec.rb
CHANGED
@@ -28,6 +28,23 @@ describe "bulk ops" do
|
|
28
28
|
@client.get("4").socks.should == "argyle"
|
29
29
|
end
|
30
30
|
|
31
|
+
it "should allow nested bulk calls" do
|
32
|
+
@client.bulk do |c|
|
33
|
+
c.index({:foo => 'bar'}, :id => '11')
|
34
|
+
c.index({:foo => 'baz'}, :id => '12')
|
35
|
+
@client.bulk do
|
36
|
+
@client.index({:socks => 'stripey'}, :id => '13')
|
37
|
+
@client.index({:socks => 'argyle'}, :id => '14')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
@client.refresh
|
41
|
+
|
42
|
+
@client.get("11").foo.should == "bar"
|
43
|
+
@client.get("12").foo.should == "baz"
|
44
|
+
@client.get("13").socks.should == "stripey"
|
45
|
+
@client.get("14").socks.should == "argyle"
|
46
|
+
end
|
47
|
+
|
31
48
|
it "should take options" do
|
32
49
|
@client.bulk do |c|
|
33
50
|
c.index({:foo => 'bar'}, :id => '1', :_routing => '1', :_parent => '1')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubberband
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-06-
|
12
|
+
date: 2011-06-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: patron
|
16
|
-
requirement: &
|
16
|
+
requirement: &10698800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *10698800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: yajl-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &10697360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *10697360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &10696040 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '2.0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *10696040
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &10695120 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.6.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *10695120
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &10693520 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *10693520
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
|
-
requirement: &
|
71
|
+
requirement: &10691980 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.3.8
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *10691980
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: mocha
|
82
|
-
requirement: &
|
82
|
+
requirement: &10688320 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 0.9.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *10688320
|
91
91
|
description: An ElasticSearch client with ThriftClient-like failover handling.
|
92
92
|
email:
|
93
93
|
- grantr@gmail.com
|