elasticsearch-api 0.4.11 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -6
- data/README.md +3 -4
- data/lib/elasticsearch/api.rb +16 -9
- data/lib/elasticsearch/api/actions/cat/aliases.rb +67 -0
- data/lib/elasticsearch/api/actions/cat/allocation.rb +69 -0
- data/lib/elasticsearch/api/actions/cat/count.rb +59 -0
- data/lib/elasticsearch/api/actions/cat/health.rb +43 -0
- data/lib/elasticsearch/api/actions/cat/help.rb +25 -0
- data/lib/elasticsearch/api/actions/cat/indices.rb +77 -0
- data/lib/elasticsearch/api/actions/cat/master.rb +40 -0
- data/lib/elasticsearch/api/actions/cat/nodes.rb +38 -0
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +40 -0
- data/lib/elasticsearch/api/actions/cat/recovery.rb +73 -0
- data/lib/elasticsearch/api/actions/cat/shards.rb +72 -0
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +3 -1
- data/lib/elasticsearch/api/actions/cluster/state.rb +23 -14
- data/lib/elasticsearch/api/actions/count_percolate.rb +78 -0
- data/lib/elasticsearch/api/actions/indices/exists.rb +4 -1
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +5 -3
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +34 -0
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +4 -1
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +5 -3
- data/lib/elasticsearch/api/actions/indices/get_aliases.rb +6 -3
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +2 -1
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +8 -3
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +7 -2
- data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -2
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -4
- data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -1
- data/lib/elasticsearch/api/actions/mpercolate.rb +58 -0
- data/lib/elasticsearch/api/actions/mtermvectors.rb +67 -0
- data/lib/elasticsearch/api/actions/{cluster/node_hot_threads.rb → nodes/hot_threads.rb} +3 -3
- data/lib/elasticsearch/api/actions/{cluster/node_info.rb → nodes/info.rb} +3 -3
- data/lib/elasticsearch/api/actions/{cluster/node_shutdown.rb → nodes/shutdown.rb} +3 -3
- data/lib/elasticsearch/api/actions/nodes/stats.rb +79 -0
- data/lib/elasticsearch/api/actions/percolate.rb +67 -21
- data/lib/elasticsearch/api/actions/snapshot/create.rb +48 -0
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +44 -0
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +41 -0
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +38 -0
- data/lib/elasticsearch/api/actions/snapshot/get.rb +47 -0
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +42 -0
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +53 -0
- data/lib/elasticsearch/api/actions/termvector.rb +77 -0
- data/lib/elasticsearch/api/namespace/cat.rb +20 -0
- data/lib/elasticsearch/api/namespace/nodes.rb +20 -0
- data/lib/elasticsearch/api/namespace/snapshot.rb +20 -0
- data/lib/elasticsearch/api/utils.rb +2 -4
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/integration/yaml_test_runner.rb +37 -8
- data/test/unit/cat/aliases_test.rb +26 -0
- data/test/unit/cat/allocation_test.rb +26 -0
- data/test/unit/cat/count_test.rb +26 -0
- data/test/unit/cat/health_test.rb +26 -0
- data/test/unit/cat/help_test.rb +26 -0
- data/test/unit/cat/indices_test.rb +26 -0
- data/test/unit/cat/master_test.rb +26 -0
- data/test/unit/cat/nodes_test.rb +26 -0
- data/test/unit/cat/pending_tasks_test.rb +26 -0
- data/test/unit/cat/recovery_test.rb +26 -0
- data/test/unit/cat/shards_test.rb +26 -0
- data/test/unit/cluster/state_test.rb +12 -3
- data/test/unit/count_percolate_test.rb +26 -0
- data/test/unit/indices/exists_alias_test.rb +0 -6
- data/test/unit/indices/exists_template_test.rb +59 -0
- data/test/unit/indices/get_alias_test.rb +0 -6
- data/test/unit/indices/get_aliases_test.rb +10 -0
- data/test/unit/indices/get_field_mapping_test.rb +1 -1
- data/test/unit/indices/get_mapping_test.rb +3 -3
- data/test/unit/indices/get_settings_test.rb +10 -0
- data/test/unit/indices/get_warmer_test.rb +0 -6
- data/test/unit/indices/put_alias_test.rb +0 -6
- data/test/unit/indices/put_mapping_test.rb +5 -11
- data/test/unit/indices/put_settings_test.rb +9 -0
- data/test/unit/indices/put_warmer_test.rb +0 -6
- data/test/unit/mpercolate_test.rb +51 -0
- data/test/unit/mtermvectors_test.rb +38 -0
- data/test/unit/{cluster/node_hot_threads_test.rb → nodes/hot_threads_test.rb} +5 -5
- data/test/unit/{cluster/node_info_test.rb → nodes/info_test.rb} +6 -6
- data/test/unit/{cluster/node_shutdown_test.rb → nodes/shutdown_test.rb} +6 -6
- data/test/unit/{cluster/node_stats_test.rb → nodes/stats_test.rb} +10 -10
- data/test/unit/percolate_test.rb +2 -13
- data/test/unit/snapshot/create_repository_test.rb +38 -0
- data/test/unit/snapshot/create_test.rb +38 -0
- data/test/unit/snapshot/delete_repository_test.rb +35 -0
- data/test/unit/snapshot/delete_test.rb +38 -0
- data/test/unit/snapshot/get_repository_test.rb +26 -0
- data/test/unit/snapshot/get_test.rb +38 -0
- data/test/unit/snapshot/restore_test.rb +38 -0
- data/test/unit/termvector_test.rb +44 -0
- data/test/unit/utils_test.rb +11 -0
- metadata +89 -17
- data/lib/elasticsearch/api/actions/cluster/node_stats.rb +0 -75
data/Gemfile
CHANGED
@@ -3,14 +3,10 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in elasticsearch-api.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
if File.exists? File.expand_path("../../elasticsearch-transport", __FILE__)
|
7
|
-
gem 'elasticsearch-transport', :path => File.expand_path("../../elasticsearch-transport", __FILE__), :require => true
|
8
|
-
end
|
9
|
-
|
10
6
|
if File.exists? File.expand_path("../../elasticsearch-extensions", __FILE__)
|
11
7
|
gem 'elasticsearch-extensions', :path => File.expand_path("../../elasticsearch-extensions", __FILE__), :require => true
|
12
8
|
end
|
13
9
|
|
14
|
-
if File.exists? File.expand_path("../../elasticsearch
|
15
|
-
gem 'elasticsearch', :path => File.expand_path("../../elasticsearch", __FILE__), :require =>
|
10
|
+
if File.exists? File.expand_path("../../elasticsearch-transport", __FILE__)
|
11
|
+
gem 'elasticsearch-transport', :path => File.expand_path("../../elasticsearch-transport", __FILE__), :require => true
|
16
12
|
end
|
data/README.md
CHANGED
@@ -54,18 +54,17 @@ require 'elasticsearch'
|
|
54
54
|
client = Elasticsearch::Client.new log: true
|
55
55
|
|
56
56
|
client.index index: 'myindex', type: 'mytype', id: 1, body: { title: 'Test' }
|
57
|
-
# => {"_index"=>"myindex", ...
|
57
|
+
# => {"ok"=>true, "_index"=>"myindex", ...}
|
58
58
|
|
59
59
|
client.search index: 'myindex', body: { query: { match: { title: 'test' } } }
|
60
60
|
# => {"took"=>2, ..., "hits"=>{"total":5, ...}}
|
61
61
|
```
|
62
62
|
|
63
|
-
Full documentation
|
64
|
-
and available online at <http://rubydoc.info/gems/elasticsearch-api>.
|
63
|
+
Full documentation is available at <http://rubydoc.info/gems/elasticsearch-api>.
|
65
64
|
|
66
65
|
### Usage with a custom client
|
67
66
|
|
68
|
-
When you want to mix the library into
|
67
|
+
When you want to mix the library into you own client, it must conform to a following _contract_:
|
69
68
|
|
70
69
|
* It responds to a `perform_request(method, path, params, body)` method,
|
71
70
|
* the method returns an object with `status`, `body` and `headers` methods.
|
data/lib/elasticsearch/api.rb
CHANGED
@@ -11,14 +11,18 @@ Dir[ File.expand_path('../api/namespace/**/*.rb', __FILE__) ].each { |f| require
|
|
11
11
|
module Elasticsearch
|
12
12
|
module API
|
13
13
|
COMMON_PARAMS = [
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
:ignore, # Client specific parameters
|
15
|
+
:index, :type, :id, # :index/:type/:id
|
16
|
+
:body, # Request body
|
17
|
+
:node_id, # Cluster
|
18
|
+
:name, # Alias, template, settings, warmer, ...
|
19
|
+
:field # Get field mapping
|
20
|
+
]
|
21
|
+
|
22
|
+
COMMON_QUERY_PARAMS = [
|
23
|
+
:format, # Search, Cat, ...
|
24
|
+
:pretty # Pretty-print the response
|
25
|
+
]
|
22
26
|
|
23
27
|
# Auto-include all namespaces in the receiver
|
24
28
|
#
|
@@ -27,7 +31,10 @@ module Elasticsearch
|
|
27
31
|
Elasticsearch::API::Common,
|
28
32
|
Elasticsearch::API::Actions,
|
29
33
|
Elasticsearch::API::Cluster,
|
30
|
-
Elasticsearch::API::
|
34
|
+
Elasticsearch::API::Nodes,
|
35
|
+
Elasticsearch::API::Indices,
|
36
|
+
Elasticsearch::API::Snapshot,
|
37
|
+
Elasticsearch::API::Cat
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Returns information about aliases, including associated routing values and filters.
|
7
|
+
#
|
8
|
+
# @example Display all aliases in the cluster
|
9
|
+
#
|
10
|
+
# puts client.cat.aliases
|
11
|
+
#
|
12
|
+
# @example Display indices for the 'year-2013' alias
|
13
|
+
#
|
14
|
+
# puts client.cat.aliases name: 'year-2013'
|
15
|
+
#
|
16
|
+
# @example Display header names in the output
|
17
|
+
#
|
18
|
+
# puts client.cat.aliases v: true
|
19
|
+
#
|
20
|
+
# @example Return only the 'alias' and 'index' columns
|
21
|
+
#
|
22
|
+
# puts client.cat.aliases h: ['alias', 'index']
|
23
|
+
#
|
24
|
+
# @example Return only the 'alias' and 'index' columns, using short names
|
25
|
+
#
|
26
|
+
# puts client.cat.aliases h: 'a,i'
|
27
|
+
#
|
28
|
+
# @example Return the information as Ruby objects
|
29
|
+
#
|
30
|
+
# client.cat.aliases format: 'json'
|
31
|
+
#
|
32
|
+
# @option arguments [List] :name A comma-separated list of alias names to return
|
33
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
34
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
35
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
36
|
+
# @option arguments [Boolean] :help Return information about headers
|
37
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
38
|
+
# (default: false)
|
39
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
40
|
+
#
|
41
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-aliases.html
|
42
|
+
#
|
43
|
+
def aliases(arguments={})
|
44
|
+
valid_params = [
|
45
|
+
:local,
|
46
|
+
:master_timeout,
|
47
|
+
:h,
|
48
|
+
:help,
|
49
|
+
:v ]
|
50
|
+
|
51
|
+
name = arguments.delete(:name)
|
52
|
+
|
53
|
+
method = 'GET'
|
54
|
+
|
55
|
+
path = Utils.__pathify '_cat/aliases', Utils.__listify(name)
|
56
|
+
|
57
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
58
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
59
|
+
|
60
|
+
body = nil
|
61
|
+
|
62
|
+
perform_request(method, path, params, body).body
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Return shard allocation information
|
7
|
+
#
|
8
|
+
# @example Display allocation for all nodes in the cluster
|
9
|
+
#
|
10
|
+
# puts client.cat.allocation
|
11
|
+
#
|
12
|
+
# @example Display allocation for node with name 'node-1'
|
13
|
+
#
|
14
|
+
# puts client.cat.allocation node_id: 'node-1'
|
15
|
+
#
|
16
|
+
# @example Display header names in the output
|
17
|
+
#
|
18
|
+
# puts client.cat.allocation v: true
|
19
|
+
#
|
20
|
+
# @example Display only specific columns in the output (see the `help` parameter)
|
21
|
+
#
|
22
|
+
# puts client.cat.allocation h: ['node', 'shards', 'disk.percent']
|
23
|
+
#
|
24
|
+
# @example Display only specific columns in the output, using the short names
|
25
|
+
#
|
26
|
+
# puts client.cat.allocation h: 'n,s,dp'
|
27
|
+
#
|
28
|
+
# @example Return the information as Ruby objects
|
29
|
+
#
|
30
|
+
# client.cat.allocation format: 'json'
|
31
|
+
#
|
32
|
+
# @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information
|
33
|
+
# @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
|
34
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
35
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
36
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
37
|
+
# @option arguments [Boolean] :help Return information about headers
|
38
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
39
|
+
# (default: false)
|
40
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
41
|
+
#
|
42
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-allocation.html
|
43
|
+
#
|
44
|
+
def allocation(arguments={})
|
45
|
+
valid_params = [
|
46
|
+
:bytes,
|
47
|
+
:local,
|
48
|
+
:master_timeout,
|
49
|
+
:h,
|
50
|
+
:help,
|
51
|
+
:v ]
|
52
|
+
|
53
|
+
node_id = arguments.delete(:node_id)
|
54
|
+
|
55
|
+
method = 'GET'
|
56
|
+
|
57
|
+
path = Utils.__pathify '_cat/allocation', Utils.__listify(node_id)
|
58
|
+
|
59
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
60
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
61
|
+
|
62
|
+
body = nil
|
63
|
+
|
64
|
+
perform_request(method, path, params, body).body
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Return document counts for the entire cluster or specific indices
|
7
|
+
#
|
8
|
+
# @example Display number of documents in the cluster
|
9
|
+
#
|
10
|
+
# puts client.cat.count
|
11
|
+
#
|
12
|
+
# @example Display number of documents in an index
|
13
|
+
#
|
14
|
+
# puts client.cat.count index: 'index-a'
|
15
|
+
#
|
16
|
+
# @example Display number of documents in a list of indices
|
17
|
+
#
|
18
|
+
# puts client.cat.count index: ['index-a', 'index-b']
|
19
|
+
#
|
20
|
+
# @example Return the information as Ruby objects
|
21
|
+
#
|
22
|
+
# client.cat.allocation format: 'json'
|
23
|
+
#
|
24
|
+
# @option arguments [List] :index A comma-separated list of index names to limit the returned information
|
25
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
26
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
27
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
28
|
+
# @option arguments [Boolean] :help Return information about headers
|
29
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
30
|
+
# (default: false)
|
31
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
32
|
+
#
|
33
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-count.html
|
34
|
+
#
|
35
|
+
def count(arguments={})
|
36
|
+
valid_params = [
|
37
|
+
:local,
|
38
|
+
:master_timeout,
|
39
|
+
:h,
|
40
|
+
:help,
|
41
|
+
:v ]
|
42
|
+
|
43
|
+
index = arguments.delete(:index)
|
44
|
+
|
45
|
+
method = 'GET'
|
46
|
+
|
47
|
+
path = Utils.__pathify '_cat/count', Utils.__listify(index)
|
48
|
+
|
49
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
50
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
51
|
+
|
52
|
+
body = nil
|
53
|
+
|
54
|
+
perform_request(method, path, params, body).body
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Display a terse version of the {Elasticsearch::API::Cluster::Actions#health} API output
|
7
|
+
#
|
8
|
+
# @example Display cluster health
|
9
|
+
#
|
10
|
+
# puts client.cat.health
|
11
|
+
#
|
12
|
+
# @option arguments [Boolean] :ts Whether to display timestamp information
|
13
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
14
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
15
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
16
|
+
# @option arguments [Boolean] :help Return information about headers
|
17
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
18
|
+
# (default: false)
|
19
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
20
|
+
#
|
21
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-health.html
|
22
|
+
#
|
23
|
+
def health(arguments={})
|
24
|
+
valid_params = [
|
25
|
+
:local,
|
26
|
+
:master_timeout,
|
27
|
+
:h,
|
28
|
+
:help,
|
29
|
+
:ts,
|
30
|
+
:v ]
|
31
|
+
|
32
|
+
method = 'GET'
|
33
|
+
path = "_cat/health"
|
34
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
35
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
36
|
+
body = nil
|
37
|
+
|
38
|
+
perform_request(method, path, params, body).body
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Help information for the Cat API
|
7
|
+
#
|
8
|
+
# @option arguments [Boolean] :help Return help information
|
9
|
+
#
|
10
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat.html
|
11
|
+
#
|
12
|
+
def help(arguments={})
|
13
|
+
valid_params = [
|
14
|
+
:help ]
|
15
|
+
method = 'GET'
|
16
|
+
path = "_cat"
|
17
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
18
|
+
body = nil
|
19
|
+
|
20
|
+
perform_request(method, path, params, body).body
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Return the most important statistics about indices, across the cluster nodes
|
7
|
+
#
|
8
|
+
# Use the `help` parameter to display available statistics.
|
9
|
+
#
|
10
|
+
# @example Display information for all indices
|
11
|
+
#
|
12
|
+
# puts client.cat.indices
|
13
|
+
#
|
14
|
+
# @example Display information for a specific index
|
15
|
+
#
|
16
|
+
# puts client.cat.indices index: 'index-a'
|
17
|
+
#
|
18
|
+
# @example Display information for indices matching a pattern
|
19
|
+
#
|
20
|
+
# puts client.cat.indices index: 'index-*'
|
21
|
+
#
|
22
|
+
# @example Display header names in the output
|
23
|
+
#
|
24
|
+
# puts client.cat.indices v: true
|
25
|
+
#
|
26
|
+
# @example Display only specific columns in the output (see the `help` parameter)
|
27
|
+
#
|
28
|
+
# puts client.cat.indices h: ['index', 'docs.count', 'fielddata.memory_size', 'filter_cache.memory_size']
|
29
|
+
#
|
30
|
+
# @example Display only specific columns in the output, using the short names
|
31
|
+
#
|
32
|
+
# puts client.cat.indices h: 'i,dc,ss,mt', v: true
|
33
|
+
#
|
34
|
+
# @example Return the information as Ruby objects
|
35
|
+
#
|
36
|
+
# client.cat.indices format: 'json'
|
37
|
+
#
|
38
|
+
# @option arguments [List] :index A comma-separated list of index names to limit the returned information
|
39
|
+
# @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
|
40
|
+
# @option arguments [Boolean] :pri Limit the returned information on primary shards only (default: false)
|
41
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
42
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
43
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
44
|
+
# @option arguments [Boolean] :help Return information about headers
|
45
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
46
|
+
# (default: false)
|
47
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
48
|
+
#
|
49
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-indices.html
|
50
|
+
#
|
51
|
+
def indices(arguments={})
|
52
|
+
valid_params = [
|
53
|
+
:bytes,
|
54
|
+
:local,
|
55
|
+
:master_timeout,
|
56
|
+
:h,
|
57
|
+
:help,
|
58
|
+
:pri,
|
59
|
+
:v ]
|
60
|
+
|
61
|
+
index = arguments.delete(:index)
|
62
|
+
|
63
|
+
method = 'GET'
|
64
|
+
|
65
|
+
path = Utils.__pathify '_cat/indices', Utils.__listify(index)
|
66
|
+
|
67
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
68
|
+
params[:h] = Utils.__listify(params[:h]) if params[:h]
|
69
|
+
|
70
|
+
body = nil
|
71
|
+
|
72
|
+
perform_request(method, path, params, body).body
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module API
|
3
|
+
module Cat
|
4
|
+
module Actions
|
5
|
+
|
6
|
+
# Display basic information about the master node
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
#
|
10
|
+
# puts client.cat.master
|
11
|
+
#
|
12
|
+
# @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
|
13
|
+
# @option arguments [Boolean] :v Display column headers as part of the output
|
14
|
+
# @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
|
15
|
+
# @option arguments [Boolean] :help Return information about headers
|
16
|
+
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
|
17
|
+
# (default: false)
|
18
|
+
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
|
19
|
+
#
|
20
|
+
# @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-master.html
|
21
|
+
#
|
22
|
+
def master(arguments={})
|
23
|
+
valid_params = [
|
24
|
+
:local,
|
25
|
+
:master_timeout,
|
26
|
+
:h,
|
27
|
+
:help,
|
28
|
+
:v ]
|
29
|
+
|
30
|
+
method = 'GET'
|
31
|
+
path = "_cat/master"
|
32
|
+
params = Utils.__validate_and_extract_params arguments, valid_params
|
33
|
+
body = nil
|
34
|
+
|
35
|
+
perform_request(method, path, params, body).body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|