lib/ej/commands.rb in ej-0.1.2 vs lib/ej/commands.rb in ej-0.1.3
- old
+ new
@@ -18,11 +18,10 @@
map '-b' => :bulk
map '-l' => :indices
map '-a' => :aliases
map '-m' => :mapping
map '-e' => :debug_eval
- map '--j2h' => :json_to_hash
map '--health' => :health
def initialize(args = [], options = {}, config = {})
super(args, options, config)
@global_options = config[:shell].base.options
@@ -96,12 +95,13 @@
end
desc 'aggs', 'aggs'
option :query, type: :string, aliases: '-q', default: '*', desc: 'query'
option :size, type: :numeric, aliases: '-n', default: 10, desc: 'size'
- def aggs(term)
- puts_with_format(@core.aggs(term, options['size'], options['query']))
+ option :terms, type: :array, aliases: '-t', required: true, desc: 'size'
+ def aggs
+ puts_with_format(@core.aggs(options['terms'], options['size'], options['query']))
end
desc 'min', 'term'
option :term, type: :string, aliases: '-k', desc: 'terms'
def min
@@ -228,14 +228,9 @@
end
desc 'nodes_stats', 'view nodes stats'
def nodes_stats
puts_with_format @core.nodes_stats
- end
-
- desc '--j2h', 'json to hash'
- def json_to_hash
- pp Yajl::Parser.parse(STDIN.read)
end
private
def puts_with_format(object)