ej 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 154e8dbacf51a33d436552fdf837531a459c6b4c
4
- data.tar.gz: 8cf243be2fce727cbafb41459d1cfefe5eada372
3
+ metadata.gz: 837f77d6076803c98698ccb1247f693ec48387f8
4
+ data.tar.gz: 969c0b55dae685c6ee5f07dfb137efc7e5206fe2
5
5
  SHA512:
6
- metadata.gz: fef634397f0f687233fe3704959abec6af604a337f604cb55869461a6efb06a6fac1389776d12c0f972f4f58337cd02bda34121d5045d2f34046d82d58b1ecc1
7
- data.tar.gz: a6fc376ae391676343014b2fd9d49f0b6fd3e7fead7531b3a7c3779e536c75444fbbe47fb4ee9d4e1a334dcbcec4e386fd24c5fd0d3266c53a53801b414dde6e
6
+ metadata.gz: 372f612991a945796bad11cd4827a068836be6055414a5946213f0f69c8fb508e3fdb506f16fb2b4ef02d95fad8d5d61daff70c3e0f8be6d4de8161e36bd0618
7
+ data.tar.gz: 892cbcd94ecbf7627f89cd0396aba6f072971468247f7f34a093bfe1949f7ef8fe653801b5f41b5f0129027ed18ed7df2c7568e13e7185b1e137a45434744caf
@@ -203,7 +203,7 @@ module Ej
203
203
  option :type, type: :string, aliases: '-t', default: nil, desc: 'type'
204
204
  option :query, type: :string, aliases: '-q', default: nil, desc: 'query'
205
205
  def delete
206
- query = eval(options[:query])
206
+ query = options[:query] ? eval(options[:query]) : nil
207
207
  @indices.delete(options[:index], options[:type], query)
208
208
  end
209
209
 
@@ -7,12 +7,26 @@ module Ej
7
7
  def initialize(global_options)
8
8
  @logger = Logger.new($stderr)
9
9
  @logger.level = global_options[:debug] ? Logger::DEBUG : Logger::INFO
10
- @client = Elasticsearch::Client.new(
11
- hosts: global_options[:host],
12
- logger: @logger,
13
- index: global_options[:index]
14
- )
10
+ @client = get_client(global_options[:host], global_options[:index])
15
11
  @index = global_options[:index]
16
12
  end
13
+
14
+ def get_client(host, index)
15
+ host, port = host.split(':')
16
+ transport = ::Elasticsearch::Transport::Transport::HTTP::Faraday.new(
17
+ {
18
+ hosts: [{ host: host, port: port }],
19
+ options: {
20
+ reload_connections: true,
21
+ reload_on_failure: false,
22
+ retry_on_failure: 5,
23
+ transport_options: {
24
+ request: { timeout: 300 }
25
+ }
26
+ }
27
+ }
28
+ )
29
+ ::Elasticsearch::Client.new transport: transport, index: index, logger: @logger
30
+ end
17
31
  end
18
32
  end
@@ -1,3 +1,3 @@
1
1
  module Ej
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ej
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - toyama0919
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler