eson-http 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.md +20 -0
- data/README.md +111 -0
- data/Rakefile +31 -0
- data/bin/elshell +20 -0
- data/eson-http.gemspec +28 -0
- data/lib/eson-http.rb +55 -0
- data/lib/eson/http.rb +16 -0
- data/lib/eson/http/api.rb +13 -0
- data/lib/eson/http/client.rb +24 -0
- data/lib/eson/http/cluster/health.rb +15 -0
- data/lib/eson/http/cluster/nodes.rb +14 -0
- data/lib/eson/http/cluster/shutdown.rb +15 -0
- data/lib/eson/http/cluster/state.rb +16 -0
- data/lib/eson/http/cluster/stats.rb +18 -0
- data/lib/eson/http/core/bulk.rb +33 -0
- data/lib/eson/http/core/count.rb +26 -0
- data/lib/eson/http/core/delete.rb +14 -0
- data/lib/eson/http/core/delete_by_query.rb +22 -0
- data/lib/eson/http/core/get.rb +15 -0
- data/lib/eson/http/core/index.rb +26 -0
- data/lib/eson/http/core/mget.rb +23 -0
- data/lib/eson/http/core/more_like_this.rb +14 -0
- data/lib/eson/http/core/msearch.rb +47 -0
- data/lib/eson/http/core/percolate.rb +16 -0
- data/lib/eson/http/core/search.rb +29 -0
- data/lib/eson/http/core/simple_search.rb +18 -0
- data/lib/eson/http/indices/aliases.rb +14 -0
- data/lib/eson/http/indices/analyze.rb +14 -0
- data/lib/eson/http/indices/clear_cache.rb +18 -0
- data/lib/eson/http/indices/close_index.rb +14 -0
- data/lib/eson/http/indices/create_index.rb +14 -0
- data/lib/eson/http/indices/delete_index.rb +14 -0
- data/lib/eson/http/indices/delete_mapping.rb +17 -0
- data/lib/eson/http/indices/delete_template.rb +14 -0
- data/lib/eson/http/indices/exists.rb +14 -0
- data/lib/eson/http/indices/flush.rb +18 -0
- data/lib/eson/http/indices/get_mapping.rb +20 -0
- data/lib/eson/http/indices/get_settings.rb +18 -0
- data/lib/eson/http/indices/get_template.rb +14 -0
- data/lib/eson/http/indices/open_index.rb +14 -0
- data/lib/eson/http/indices/optimize.rb +18 -0
- data/lib/eson/http/indices/put_mapping.rb +16 -0
- data/lib/eson/http/indices/put_template.rb +14 -0
- data/lib/eson/http/indices/refresh.rb +18 -0
- data/lib/eson/http/indices/segments.rb +18 -0
- data/lib/eson/http/indices/snapshot.rb +18 -0
- data/lib/eson/http/indices/stats.rb +18 -0
- data/lib/eson/http/indices/status.rb +18 -0
- data/lib/eson/http/indices/update_settings.rb +18 -0
- data/lib/eson/http/request.rb +95 -0
- data/lib/eson/modules/response_parser.rb +22 -0
- data/lib/eson/modules/status_handler.rb +24 -0
- data/log4j.properties +18 -0
- data/test/http/client_test.rb +14 -0
- data/test/http/cluster_test.rb +58 -0
- data/test/http/index_test.rb +180 -0
- data/test/http/indices/basics_test.rb +257 -0
- data/test/http/query_test.rb +70 -0
- data/test/modules/query_plugin_test.rb +40 -0
- data/test/seeds/seeds.rb +30 -0
- data/test/test_config.rb +33 -0
- metadata +202 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
require './test/test_config'
|
2
|
+
require 'eson-dsl'
|
3
|
+
|
4
|
+
context "QueryPlugin" do
|
5
|
+
helper(:node) { Node::External.instance }
|
6
|
+
|
7
|
+
helper(:client) do
|
8
|
+
Eson::HTTP::Client.new(:server => "http://#{node.ip}:#{node.port}",
|
9
|
+
:logger => 'test/test.log')
|
10
|
+
end
|
11
|
+
|
12
|
+
setup do
|
13
|
+
client.create_index :index => "default" rescue nil
|
14
|
+
client.refresh
|
15
|
+
end
|
16
|
+
|
17
|
+
context "#search" do
|
18
|
+
setup do
|
19
|
+
client.search do
|
20
|
+
query {
|
21
|
+
match_all
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
asserts("has hits") { topic["hits"] }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "#delete_by_query" do
|
30
|
+
setup do
|
31
|
+
client.delete_by_query do
|
32
|
+
query {
|
33
|
+
match_all
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
asserts("ok"){ topic["ok"] }.equals(true)
|
39
|
+
end
|
40
|
+
end
|
data/test/seeds/seeds.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# basically, this is also a test for the bulk interface :)
|
2
|
+
|
3
|
+
node = Node::External.instance
|
4
|
+
|
5
|
+
c = Eson::Client.new(:server => "http://#{node.ip}:#{node.port}",
|
6
|
+
:protocol => Eson::HTTP,
|
7
|
+
:plugins => [Eson::ResponseParser],
|
8
|
+
:logger => 'test/test.log')
|
9
|
+
|
10
|
+
c.delete_index :index => "_all" rescue nil
|
11
|
+
|
12
|
+
|
13
|
+
c.bulk do |bulk_request|
|
14
|
+
1.upto(500) do |i|
|
15
|
+
bulk_request.index :index => "default",
|
16
|
+
:type => "bar",
|
17
|
+
:doc => {"foo" => "bar"}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
c.create_index :index => "for_deletion"
|
22
|
+
c.delete_index :index => "for_creation" rescue nil
|
23
|
+
c.delete_index :index => "for_creation_with_settings_and_mappings" rescue nil
|
24
|
+
c.delete_index :index => "abc" rescue nil
|
25
|
+
c.delete_index :index => "def" rescue nil
|
26
|
+
|
27
|
+
c.open_index :index => "for_closing" rescue nil
|
28
|
+
c.delete_index :index => "for_closing" rescue nil
|
29
|
+
c.delete_index :index => "for_reopening" rescue nil
|
30
|
+
c.delete_index :index => "mappings" rescue nil
|
data/test/test_config.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
begin
|
2
|
+
# Require the preresolved locked set of gems.
|
3
|
+
require File.expand_path('../../.bundle/environment', __FILE__)
|
4
|
+
rescue LoadError
|
5
|
+
# Fallback on doing the resolve at runtime.
|
6
|
+
require 'rubygems'
|
7
|
+
require 'bundler'
|
8
|
+
Bundler.setup
|
9
|
+
end
|
10
|
+
|
11
|
+
Bundler.require(:test, :default)
|
12
|
+
|
13
|
+
require 'eson-http'
|
14
|
+
|
15
|
+
require 'elasticsearch-node/external'
|
16
|
+
|
17
|
+
module Node
|
18
|
+
module External
|
19
|
+
def self.instance
|
20
|
+
@node ||= begin
|
21
|
+
node = ElasticSearch::Node::External.new("gateway.type" => "none")
|
22
|
+
at_exit do
|
23
|
+
node.close
|
24
|
+
end
|
25
|
+
node
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Node::External.instance
|
32
|
+
require 'riot'
|
33
|
+
require './test/seeds/seeds'
|
metadata
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eson-http
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Florian Gilcher
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: faraday
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.7.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.7.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: addressable
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: eson-core
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: elasticsearch-node
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: riot
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: ! "A modular client for Eson. It provides\n an implementation of the
|
95
|
+
Query language as well as multiple client implementations\n for HTTP and native
|
96
|
+
access."
|
97
|
+
email:
|
98
|
+
- florian.gilcher@asquera.de
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- LICENSE.md
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
106
|
+
- bin/elshell
|
107
|
+
- eson-http.gemspec
|
108
|
+
- lib/eson-http.rb
|
109
|
+
- lib/eson/http.rb
|
110
|
+
- lib/eson/http/api.rb
|
111
|
+
- lib/eson/http/client.rb
|
112
|
+
- lib/eson/http/cluster/health.rb
|
113
|
+
- lib/eson/http/cluster/nodes.rb
|
114
|
+
- lib/eson/http/cluster/shutdown.rb
|
115
|
+
- lib/eson/http/cluster/state.rb
|
116
|
+
- lib/eson/http/cluster/stats.rb
|
117
|
+
- lib/eson/http/core/bulk.rb
|
118
|
+
- lib/eson/http/core/count.rb
|
119
|
+
- lib/eson/http/core/delete.rb
|
120
|
+
- lib/eson/http/core/delete_by_query.rb
|
121
|
+
- lib/eson/http/core/get.rb
|
122
|
+
- lib/eson/http/core/index.rb
|
123
|
+
- lib/eson/http/core/mget.rb
|
124
|
+
- lib/eson/http/core/more_like_this.rb
|
125
|
+
- lib/eson/http/core/msearch.rb
|
126
|
+
- lib/eson/http/core/percolate.rb
|
127
|
+
- lib/eson/http/core/search.rb
|
128
|
+
- lib/eson/http/core/simple_search.rb
|
129
|
+
- lib/eson/http/indices/aliases.rb
|
130
|
+
- lib/eson/http/indices/analyze.rb
|
131
|
+
- lib/eson/http/indices/clear_cache.rb
|
132
|
+
- lib/eson/http/indices/close_index.rb
|
133
|
+
- lib/eson/http/indices/create_index.rb
|
134
|
+
- lib/eson/http/indices/delete_index.rb
|
135
|
+
- lib/eson/http/indices/delete_mapping.rb
|
136
|
+
- lib/eson/http/indices/delete_template.rb
|
137
|
+
- lib/eson/http/indices/exists.rb
|
138
|
+
- lib/eson/http/indices/flush.rb
|
139
|
+
- lib/eson/http/indices/get_mapping.rb
|
140
|
+
- lib/eson/http/indices/get_settings.rb
|
141
|
+
- lib/eson/http/indices/get_template.rb
|
142
|
+
- lib/eson/http/indices/open_index.rb
|
143
|
+
- lib/eson/http/indices/optimize.rb
|
144
|
+
- lib/eson/http/indices/put_mapping.rb
|
145
|
+
- lib/eson/http/indices/put_template.rb
|
146
|
+
- lib/eson/http/indices/refresh.rb
|
147
|
+
- lib/eson/http/indices/segments.rb
|
148
|
+
- lib/eson/http/indices/snapshot.rb
|
149
|
+
- lib/eson/http/indices/stats.rb
|
150
|
+
- lib/eson/http/indices/status.rb
|
151
|
+
- lib/eson/http/indices/update_settings.rb
|
152
|
+
- lib/eson/http/request.rb
|
153
|
+
- lib/eson/modules/response_parser.rb
|
154
|
+
- lib/eson/modules/status_handler.rb
|
155
|
+
- log4j.properties
|
156
|
+
- test/http/client_test.rb
|
157
|
+
- test/http/cluster_test.rb
|
158
|
+
- test/http/index_test.rb
|
159
|
+
- test/http/indices/basics_test.rb
|
160
|
+
- test/http/query_test.rb
|
161
|
+
- test/modules/query_plugin_test.rb
|
162
|
+
- test/seeds/seeds.rb
|
163
|
+
- test/test_config.rb
|
164
|
+
homepage: ''
|
165
|
+
licenses: []
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
hash: 3355220238060799392
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
181
|
+
requirements:
|
182
|
+
- - ! '>='
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
segments:
|
186
|
+
- 0
|
187
|
+
hash: 3355220238060799392
|
188
|
+
requirements: []
|
189
|
+
rubyforge_project:
|
190
|
+
rubygems_version: 1.8.21
|
191
|
+
signing_key:
|
192
|
+
specification_version: 3
|
193
|
+
summary: A modular client for Eson - HTTP interface
|
194
|
+
test_files:
|
195
|
+
- test/http/client_test.rb
|
196
|
+
- test/http/cluster_test.rb
|
197
|
+
- test/http/index_test.rb
|
198
|
+
- test/http/indices/basics_test.rb
|
199
|
+
- test/http/query_test.rb
|
200
|
+
- test/modules/query_plugin_test.rb
|
201
|
+
- test/seeds/seeds.rb
|
202
|
+
- test/test_config.rb
|