ej 0.0.12 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/ej.gemspec +0 -1
- data/lib/ej/commands.rb +0 -15
- data/lib/ej/core.rb +4 -1
- data/lib/ej/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ba7f44c1f49100a84246846a99b87fa467ead32
|
4
|
+
data.tar.gz: 6223584d39aea4b09bfc2b87ecf8dd5f9e0a1127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c167c8f5deea539ab58a5749f2bb6053603217fc5c7b227b7f34b5b77d52dba7211f0ef277bdbebb1343604435bbfca42a1ce76f5843e90951bfc4ef0814b536
|
7
|
+
data.tar.gz: 638512a42e5d2ddcdaedaa19085b2d17c054c338aacaecb8b92b1f7edddc610447e0ff3b80e42ecb0f80fe1bf09b88e8998eb63e8f3f4089bd7a3b47fdd7ec26
|
data/README.md
CHANGED
data/ej.gemspec
CHANGED
data/lib/ej/commands.rb
CHANGED
@@ -4,8 +4,6 @@ require 'thor'
|
|
4
4
|
require 'yajl'
|
5
5
|
require 'elasticsearch'
|
6
6
|
require 'ej/core'
|
7
|
-
require 'active_support/core_ext/array'
|
8
|
-
require 'active_support/core_ext/string'
|
9
7
|
require 'logger'
|
10
8
|
|
11
9
|
module Ej
|
@@ -13,7 +11,6 @@ module Ej
|
|
13
11
|
class_option :index, aliases: '-i', type: :string, default: '_all', desc: 'index'
|
14
12
|
class_option :host, aliases: '-h', type: :string, default: 'localhost', desc: 'host'
|
15
13
|
class_option :debug, aliases: '-d', type: :string, default: false, desc: 'debug mode'
|
16
|
-
class_option :format, type: :string, default: 'json', enum: ['json', 'yaml'], desc: 'format'
|
17
14
|
|
18
15
|
map '-s' => :search
|
19
16
|
map '-f' => :facet
|
@@ -234,20 +231,8 @@ module Ej
|
|
234
231
|
private
|
235
232
|
|
236
233
|
def puts_with_format(object)
|
237
|
-
if options['format'] == 'json'
|
238
|
-
puts_json(object)
|
239
|
-
elsif options['format'] == 'yaml'
|
240
|
-
puts_yaml(object)
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
def puts_json(object)
|
245
234
|
puts Yajl::Encoder.encode(object, pretty: true)
|
246
235
|
end
|
247
236
|
|
248
|
-
def puts_yaml(object)
|
249
|
-
puts YAML.dump(object)
|
250
|
-
end
|
251
|
-
|
252
237
|
end
|
253
238
|
end
|
data/lib/ej/core.rb
CHANGED
@@ -57,6 +57,9 @@ module Ej
|
|
57
57
|
docs.each do |doc|
|
58
58
|
source = doc.delete('_source')
|
59
59
|
doc.delete('_score')
|
60
|
+
['_id', '_type', '_index'].each do |meta_field|
|
61
|
+
source.delete(meta_field)
|
62
|
+
end
|
60
63
|
bulk_message << { index: doc.to_h }
|
61
64
|
bulk_message << source
|
62
65
|
end
|
@@ -239,7 +242,7 @@ module Ej
|
|
239
242
|
bulk_message << meta
|
240
243
|
bulk_message << record
|
241
244
|
end
|
242
|
-
bulk_message.
|
245
|
+
bulk_message.each_slice(10000).each do |block|
|
243
246
|
@client.bulk body: block
|
244
247
|
end
|
245
248
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toyama0919
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,20 +122,6 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: activesupport
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: hashie
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
182
|
version: '0'
|
197
183
|
requirements: []
|
198
184
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.5.1
|
200
186
|
signing_key:
|
201
187
|
specification_version: 4
|
202
188
|
summary: elasticsearch command line utility.
|