This repository was archived by the owner on Mar 25, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
lib/logstash/outputs/elasticsearch_java Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,6 @@ def initialize(options={})
14
14
@logger = Cabin ::Channel . get
15
15
end
16
16
17
- def client
18
- return @client if @client
19
- @client = build_client ( @options )
20
- return @client
21
- end
22
-
23
17
def template_install ( name , template , force = false )
24
18
if template_exists? ( name ) && !force
25
19
@logger . debug ( "Found existing Elasticsearch template. Skipping template management" , :name => name )
@@ -236,6 +230,13 @@ def template_put(name, template)
236
230
end # class NodeClient
237
231
238
232
class TransportClient < NodeClient
233
+ def client
234
+ return @client if @client
235
+ @client = build_client ( @options )
236
+ return @client
237
+ end
238
+
239
+
239
240
private
240
241
def build_client ( options )
241
242
client = org . elasticsearch . client . transport . TransportClient .
Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ def get_es_output(action, id = nil)
29
29
end
30
30
31
31
context "when action => create" do
32
+ it "should instantiate a transport, not node, client" do
33
+ subject = get_es_output ( "create" , "id123" )
34
+ subject . register
35
+ expect ( subject . client . send ( :client ) . class ) . to eql ( Java ::OrgElasticsearchClientTransport ::TransportClient )
36
+ end
37
+
32
38
it "should create new documents with or without id" do
33
39
subject = get_es_output ( "create" , "id123" )
34
40
subject . register
You can’t perform that action at this time.
0 commit comments