jruby-elasticsearch 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jruby-elasticsearch/client.rb +25 -12
- metadata +10 -10
@@ -4,24 +4,37 @@ require "jruby-elasticsearch/indexrequest"
|
|
4
4
|
require "jruby-elasticsearch/searchrequest"
|
5
5
|
|
6
6
|
class ElasticSearch::Client
|
7
|
+
|
8
|
+
# Creates a new ElasticSearch client.
|
9
|
+
#
|
10
|
+
# options:
|
11
|
+
# :type => [:local, :node] - :local will create a process-local
|
12
|
+
# elasticsearch instances
|
13
|
+
# :host => "hostname" - the hostname to connect to.
|
14
|
+
# :port => 9200 - the port to connect to
|
15
|
+
# :cluster => "clustername" - the cluster name to use
|
7
16
|
def initialize(options={})
|
8
17
|
builder = org.elasticsearch.node.NodeBuilder.nodeBuilder
|
9
18
|
builder.client(true)
|
10
19
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
20
|
+
if options[:type] == :local
|
21
|
+
builder.local(true)
|
22
|
+
else
|
23
|
+
# Use unicast discovery a host is given
|
24
|
+
if !options[:host].nil?
|
25
|
+
port = (options[:port] or "9300")
|
26
|
+
builder.settings.put("discovery.zen.ping.multicast.enabled", false)
|
27
|
+
builder.settings.put("discovery.zen.ping.unicast.hosts", "#{options[:host]}:#{port}")
|
28
|
+
#builder.settings.put("es.transport.tcp.port", port)
|
29
|
+
end
|
18
30
|
|
19
|
-
|
20
|
-
|
21
|
-
|
31
|
+
if options[:bind_host]
|
32
|
+
builder.settings.put('network.host', options[:bind_host])
|
33
|
+
end
|
22
34
|
|
23
|
-
|
24
|
-
|
35
|
+
if !options[:cluster].nil?
|
36
|
+
builder.clusterName(options[:cluster])
|
37
|
+
end
|
25
38
|
end
|
26
39
|
|
27
40
|
@node = builder.node
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 13
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jordan Sissel
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-08 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -30,12 +30,12 @@ extra_rdoc_files: []
|
|
30
30
|
|
31
31
|
files:
|
32
32
|
- lib/jruby-elasticsearch.rb
|
33
|
-
- lib/jruby-elasticsearch/searchrequest.rb
|
34
|
-
- lib/jruby-elasticsearch/namespace.rb
|
35
|
-
- lib/jruby-elasticsearch/bulkrequest.rb
|
36
|
-
- lib/jruby-elasticsearch/actionlistener.rb
|
37
33
|
- lib/jruby-elasticsearch/request.rb
|
34
|
+
- lib/jruby-elasticsearch/searchrequest.rb
|
38
35
|
- lib/jruby-elasticsearch/indexrequest.rb
|
36
|
+
- lib/jruby-elasticsearch/actionlistener.rb
|
37
|
+
- lib/jruby-elasticsearch/bulkrequest.rb
|
38
|
+
- lib/jruby-elasticsearch/namespace.rb
|
39
39
|
- lib/jruby-elasticsearch/client.rb
|
40
40
|
- lib/jruby-elasticsearch/bulkstream.rb
|
41
41
|
has_rdoc: true
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
requirements: []
|
70
70
|
|
71
71
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.
|
72
|
+
rubygems_version: 1.3.7
|
73
73
|
signing_key:
|
74
74
|
specification_version: 3
|
75
75
|
summary: JRuby API for ElasticSearch using the native ES Java API
|