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 +4 -4
- data/lib/ej/commands.rb +1 -1
- data/lib/ej/values.rb +19 -5
- data/lib/ej/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837f77d6076803c98698ccb1247f693ec48387f8
|
4
|
+
data.tar.gz: 969c0b55dae685c6ee5f07dfb137efc7e5206fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 372f612991a945796bad11cd4827a068836be6055414a5946213f0f69c8fb508e3fdb506f16fb2b4ef02d95fad8d5d61daff70c3e0f8be6d4de8161e36bd0618
|
7
|
+
data.tar.gz: 892cbcd94ecbf7627f89cd0396aba6f072971468247f7f34a093bfe1949f7ef8fe653801b5f41b5f0129027ed18ed7df2c7568e13e7185b1e137a45434744caf
|
data/lib/ej/commands.rb
CHANGED
@@ -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
|
|
data/lib/ej/values.rb
CHANGED
@@ -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 =
|
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
|
data/lib/ej/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|