estool 0.2.1 → 0.2.2

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: b7e7ce0b66d13b4530fd66b8c13a9a52fc57e881
4
- data.tar.gz: 4198e9fa1717bb703f61d09852600e8c0bd29194
3
+ metadata.gz: 9b796b14201ba030ce8cc0754cec0c57c92be380
4
+ data.tar.gz: deebecfb4219e665f3b7142eb6a5988c77053cc3
5
5
  SHA512:
6
- metadata.gz: 89fe4326849d0b68ce3699fd44bdc34493c31dd364aa4bae8710502f2a86318f6d90ccf2bc845a6c5949e8ea2be4c9be19d079d8f669ba7cc4fc31b495ef1dd4
7
- data.tar.gz: 6dd633ffdc0171c0bc723137a6320ab62480223f2191603f9e9923fdcb265b94beb061da38452a982f6affcf58e8e1d3ec07877a19452d9f4bc32786975fb54f
6
+ metadata.gz: b3ec563efba29dba758f1d5a91efcc20a192d66028428371ab2490b4751b5c61a92ddb2cf53bcc133aa2cf0d87c31ad531946869751d3b4fdeeef811d5e1a9cc
7
+ data.tar.gz: f520c9c03b9c594a8279858373ad126c5a750554b0146f9d4882db3fd7270d7cb1dcc66ad2e56f28897b560349f998c260b702fc63c5e89b136bbc8fbf77ebae
data/README.md CHANGED
@@ -3,10 +3,93 @@ ESTool - Elasticsearch Commandline Tool
3
3
 
4
4
  EStool is a command-line tool for interacting with the Elasticsearch search and analytics engine.
5
5
 
6
- Documentation
7
- -------------
6
+ ## Installation
7
+
8
+ Install the gem
9
+
10
+ gem install estool
11
+
12
+ ## Requirements
13
+
14
+ * Requires Elasticsearch cluster accessible over HTTP.
15
+ * Tested on Elasticsearch 1.7.x, 2.3.x, 5.x
16
+ * Ruby 2.2.6
17
+
18
+ ## Using estool
19
+
20
+ Getting help:
21
+
22
+ estool -h
23
+
24
+ Global options:
25
+
26
+ * `-h, --host=HOST` - Elasticsearch node to connect to. Default: `localhost`
27
+ * `-p, --port=PORT` - HTTP port to connect to. Default: `9200`
28
+ * `-v, --verbose` - Show verbose output. In most commands this is represented by column headings. Not supported by all commands.
29
+
30
+ #### Cluster Health
31
+
32
+ This subcommand will print the cluster health out to the screen.
33
+
34
+ $ estool health
35
+
36
+ More options can be listed with `$ estool health -h`
37
+
38
+ #### Indices
39
+
40
+ This subcommand is used to interact with the Cluster Indices.
41
+
42
+ Currently supports following actions:
43
+ * list indices
44
+ * create/delete/close indices
45
+
46
+ ##### Examples
47
+ Create a new index:
48
+
49
+ $ estool index create --name=index1
50
+
51
+ Delete an index:
52
+
53
+ $ estool index delete --name=index1
54
+
55
+ Close an index:
56
+
57
+ $ estool index close --name=index1
58
+
59
+ Show indices:
60
+
61
+ the `index` subcommand defaults to the show command, so you can get a list of indices simply by running:
62
+
63
+ $ estool index
64
+
65
+ #### Aliases
66
+
67
+ This subcommand is used to interact with Index aliases within the cluster.
68
+
69
+ Currently supported actions:
70
+ * list aliases
71
+ * create/delete aliases
72
+
73
+ ##### Examples
74
+
75
+ Create a new alias:
76
+
77
+ $ estool aliases create -i index1 -n test_index
78
+
79
+ Delete an alias:
80
+
81
+ $ estool aliases delete -i index1 -n test_index
82
+
83
+ List aliases:
84
+
85
+ $ estool aliases
86
+
87
+ Like the `estool index` command, `estool aliases` defaults to listing the aliases for all indices.
88
+
89
+ List aliases for an index:
90
+
91
+ $ estool aliases list -i index1
8
92
 
9
- Tool is still in development. Only portions of Elasticsearch's [Cat API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html) have been implemented so far.
10
93
 
11
94
  License
12
95
  -------
@@ -16,17 +16,17 @@ module Estool::Actions
16
16
  data.each do |k, v|
17
17
  case k
18
18
  when :verbose
19
- params.merge!(v: v)
20
- when :output
21
- params.merge!(format: v)
22
- when :name
23
- params.merge!(name: v)
24
- when :node
25
- params.merge!(node_id: v)
26
- when :primary
27
- params.merge!(pri: v)
28
- else
29
- params.merge!("#{k}": v)
19
+ params.merge!(v: v)
20
+ when :output
21
+ params.merge!(format: v)
22
+ when :name
23
+ params.merge!(name: v)
24
+ when :node
25
+ params.merge!(node_id: v)
26
+ when :primary
27
+ params.merge!(pri: v)
28
+ else
29
+ params.merge!("#{k}": v)
30
30
  end
31
31
  end
32
32
  return params
@@ -15,14 +15,12 @@ module Estool::Actions
15
15
  params = {}
16
16
  data.each do |k, v|
17
17
  case k
18
- when :name
19
- params.merge!(index: v)
20
- when :update
21
- params.merge!(update_all_types: v)
22
- when :wait
23
- params.merge!(wait_for_active_shards: v)
24
- else
25
- params.merge!("#{k}": v)
18
+ when :update
19
+ params.merge!(update_all_types: v)
20
+ when :wait
21
+ params.merge!(wait_for_active_shards: v)
22
+ else
23
+ params.merge!("#{k}": v)
26
24
  end
27
25
  end
28
26
  return params
@@ -6,14 +6,8 @@ module Estool
6
6
  command :aliases do |c|
7
7
 
8
8
  c.desc 'Get a list of aliases'
9
- c.long_desc %{
10
- Get a list of all aliases or a list of aliases for a specific index.
11
- }
12
9
  c.command [:list, :ls] do |ls|
13
10
 
14
- ls.flag 'name', :arg_name => 'alias name(s)',
15
- :desc => 'Comma separated list of aliases to get information about'
16
-
17
11
  ls.flag [:index, :i], :arg_name => 'index name(s)',
18
12
  :desc => 'Comma separated list of index names'
19
13
 
@@ -28,6 +22,52 @@ module Estool
28
22
  ls_alias.run
29
23
  end
30
24
  end
25
+
26
+ c.desc 'create an alias for an index.'
27
+ c.command [:create, :c] do |create|
28
+ create.flag [:name, :n], :arg_name => 'alias name',
29
+ :required => true,
30
+ :desc => 'What to name the alias.'
31
+
32
+ create.flag [:index, :i], :arg_name => 'index name',
33
+ :required => true,
34
+ :desc => 'Index to apply alias to.'
35
+
36
+ create.action do |global_options,options,args|
37
+ options = {
38
+ host: global_options[:host],
39
+ port: global_options[:port],
40
+ name: options[:name],
41
+ index: options[:index]
42
+ }
43
+ cr_alias = Estool::Actions::Index.new('put_alias', options)
44
+ cr_alias.run
45
+ end
46
+ end
47
+
48
+ c.desc 'delete an alias for an index.'
49
+ c.command [:delete, :d] do |delete|
50
+ delete.flag [:name, :n], :arg_name => 'alias name',
51
+ :required => true,
52
+ :desc => 'Which alias to delete.'
53
+
54
+ delete.flag [:index, :i], :arg_name => 'index name',
55
+ :required => true,
56
+ :desc => 'Index to apply alias to.'
57
+
58
+ delete.action do |global_options,options,args|
59
+ options = {
60
+ host: global_options[:host],
61
+ port: global_options[:port],
62
+ name: options[:name],
63
+ index: options[:index]
64
+ }
65
+ dl_alias = Estool::Actions::Index.new('delete_alias', options)
66
+ dl_alias.run
67
+ end
68
+ end
69
+
70
+ c.default_command :list
31
71
  end
32
72
  end
33
73
  end
@@ -24,7 +24,7 @@ module Estool
24
24
  options = {
25
25
  host: global_options[:host],
26
26
  port: global_options[:port],
27
- name: options[:name],
27
+ index: options[:name],
28
28
  update: options[:update],
29
29
  wait: options[:wait]
30
30
  }
@@ -9,13 +9,11 @@ module Estool
9
9
  end
10
10
 
11
11
  def self.test_conn(client)
12
- begin
13
- client.perform_request 'GET', '_cluster/health'
14
- rescue Faraday::ConnectionFailed => connfail
15
- # Connection Failure Message
16
- puts connfail
17
- exit 1
18
- end
12
+ client.perform_request 'GET', '_cluster/health'
13
+ rescue Faraday::ConnectionFailed => connfail
14
+ # Connection Failure Message
15
+ puts connfail
16
+ exit 1
19
17
  end
20
18
  end
21
19
  end
@@ -1,4 +1,4 @@
1
1
  module Estool
2
2
  ESTOOL_ROOT = File.expand_path("../..", __FILE__)
3
- VERSION = "0.2.1"
3
+ VERSION = '0.2.2'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: estool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hollinger III
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2017-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch
@@ -70,7 +70,10 @@ dependencies:
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: 3.0.0
73
- description:
73
+ description: |-
74
+ Command Line tool for interacting with Elasticsearch.
75
+ Still in Development, expect bugs and fast releases
76
+ until 1.0.0.
74
77
  email:
75
78
  - david.hollinger@moduletux.com
76
79
  executables:
@@ -113,8 +116,5 @@ rubyforge_project:
113
116
  rubygems_version: 2.4.5.2
114
117
  signing_key:
115
118
  specification_version: 4
116
- summary: 'Command Line tool for interacting with Elasticsearch. Still in Development,
117
- expect bugs and fast releases until 1.0.0. NOTE: version 0.2.0 involves a complete
118
- CLI rewrite. Some options have not been reimplemented, others have changed, and
119
- a new command implemented'
119
+ summary: Command Line tool for Elasticsearch
120
120
  test_files: []