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.
Files changed (94) hide show
  1. data/Gemfile +2 -6
  2. data/README.md +3 -4
  3. data/lib/elasticsearch/api.rb +16 -9
  4. data/lib/elasticsearch/api/actions/cat/aliases.rb +67 -0
  5. data/lib/elasticsearch/api/actions/cat/allocation.rb +69 -0
  6. data/lib/elasticsearch/api/actions/cat/count.rb +59 -0
  7. data/lib/elasticsearch/api/actions/cat/health.rb +43 -0
  8. data/lib/elasticsearch/api/actions/cat/help.rb +25 -0
  9. data/lib/elasticsearch/api/actions/cat/indices.rb +77 -0
  10. data/lib/elasticsearch/api/actions/cat/master.rb +40 -0
  11. data/lib/elasticsearch/api/actions/cat/nodes.rb +38 -0
  12. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +40 -0
  13. data/lib/elasticsearch/api/actions/cat/recovery.rb +73 -0
  14. data/lib/elasticsearch/api/actions/cat/shards.rb +72 -0
  15. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +3 -1
  16. data/lib/elasticsearch/api/actions/cluster/state.rb +23 -14
  17. data/lib/elasticsearch/api/actions/count_percolate.rb +78 -0
  18. data/lib/elasticsearch/api/actions/indices/exists.rb +4 -1
  19. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +5 -3
  20. data/lib/elasticsearch/api/actions/indices/exists_template.rb +34 -0
  21. data/lib/elasticsearch/api/actions/indices/exists_type.rb +4 -1
  22. data/lib/elasticsearch/api/actions/indices/get_alias.rb +5 -3
  23. data/lib/elasticsearch/api/actions/indices/get_aliases.rb +6 -3
  24. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +2 -1
  25. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +8 -3
  26. data/lib/elasticsearch/api/actions/indices/get_settings.rb +7 -2
  27. data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -2
  28. data/lib/elasticsearch/api/actions/indices/put_alias.rb +0 -1
  29. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -4
  30. data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -1
  31. data/lib/elasticsearch/api/actions/mpercolate.rb +58 -0
  32. data/lib/elasticsearch/api/actions/mtermvectors.rb +67 -0
  33. data/lib/elasticsearch/api/actions/{cluster/node_hot_threads.rb → nodes/hot_threads.rb} +3 -3
  34. data/lib/elasticsearch/api/actions/{cluster/node_info.rb → nodes/info.rb} +3 -3
  35. data/lib/elasticsearch/api/actions/{cluster/node_shutdown.rb → nodes/shutdown.rb} +3 -3
  36. data/lib/elasticsearch/api/actions/nodes/stats.rb +79 -0
  37. data/lib/elasticsearch/api/actions/percolate.rb +67 -21
  38. data/lib/elasticsearch/api/actions/snapshot/create.rb +48 -0
  39. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +44 -0
  40. data/lib/elasticsearch/api/actions/snapshot/delete.rb +41 -0
  41. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +38 -0
  42. data/lib/elasticsearch/api/actions/snapshot/get.rb +47 -0
  43. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +42 -0
  44. data/lib/elasticsearch/api/actions/snapshot/restore.rb +53 -0
  45. data/lib/elasticsearch/api/actions/termvector.rb +77 -0
  46. data/lib/elasticsearch/api/namespace/cat.rb +20 -0
  47. data/lib/elasticsearch/api/namespace/nodes.rb +20 -0
  48. data/lib/elasticsearch/api/namespace/snapshot.rb +20 -0
  49. data/lib/elasticsearch/api/utils.rb +2 -4
  50. data/lib/elasticsearch/api/version.rb +1 -1
  51. data/test/integration/yaml_test_runner.rb +37 -8
  52. data/test/unit/cat/aliases_test.rb +26 -0
  53. data/test/unit/cat/allocation_test.rb +26 -0
  54. data/test/unit/cat/count_test.rb +26 -0
  55. data/test/unit/cat/health_test.rb +26 -0
  56. data/test/unit/cat/help_test.rb +26 -0
  57. data/test/unit/cat/indices_test.rb +26 -0
  58. data/test/unit/cat/master_test.rb +26 -0
  59. data/test/unit/cat/nodes_test.rb +26 -0
  60. data/test/unit/cat/pending_tasks_test.rb +26 -0
  61. data/test/unit/cat/recovery_test.rb +26 -0
  62. data/test/unit/cat/shards_test.rb +26 -0
  63. data/test/unit/cluster/state_test.rb +12 -3
  64. data/test/unit/count_percolate_test.rb +26 -0
  65. data/test/unit/indices/exists_alias_test.rb +0 -6
  66. data/test/unit/indices/exists_template_test.rb +59 -0
  67. data/test/unit/indices/get_alias_test.rb +0 -6
  68. data/test/unit/indices/get_aliases_test.rb +10 -0
  69. data/test/unit/indices/get_field_mapping_test.rb +1 -1
  70. data/test/unit/indices/get_mapping_test.rb +3 -3
  71. data/test/unit/indices/get_settings_test.rb +10 -0
  72. data/test/unit/indices/get_warmer_test.rb +0 -6
  73. data/test/unit/indices/put_alias_test.rb +0 -6
  74. data/test/unit/indices/put_mapping_test.rb +5 -11
  75. data/test/unit/indices/put_settings_test.rb +9 -0
  76. data/test/unit/indices/put_warmer_test.rb +0 -6
  77. data/test/unit/mpercolate_test.rb +51 -0
  78. data/test/unit/mtermvectors_test.rb +38 -0
  79. data/test/unit/{cluster/node_hot_threads_test.rb → nodes/hot_threads_test.rb} +5 -5
  80. data/test/unit/{cluster/node_info_test.rb → nodes/info_test.rb} +6 -6
  81. data/test/unit/{cluster/node_shutdown_test.rb → nodes/shutdown_test.rb} +6 -6
  82. data/test/unit/{cluster/node_stats_test.rb → nodes/stats_test.rb} +10 -10
  83. data/test/unit/percolate_test.rb +2 -13
  84. data/test/unit/snapshot/create_repository_test.rb +38 -0
  85. data/test/unit/snapshot/create_test.rb +38 -0
  86. data/test/unit/snapshot/delete_repository_test.rb +35 -0
  87. data/test/unit/snapshot/delete_test.rb +38 -0
  88. data/test/unit/snapshot/get_repository_test.rb +26 -0
  89. data/test/unit/snapshot/get_test.rb +38 -0
  90. data/test/unit/snapshot/restore_test.rb +38 -0
  91. data/test/unit/termvector_test.rb +44 -0
  92. data/test/unit/utils_test.rb +11 -0
  93. metadata +89 -17
  94. data/lib/elasticsearch/api/actions/cluster/node_stats.rb +0 -75
@@ -17,6 +17,8 @@ module Elasticsearch
17
17
  # `missing` ones (options: none, missing) @until 1.0
18
18
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
19
19
  # unavailable (missing, closed, etc)
20
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
21
+ # (default: false)
20
22
  #
21
23
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-types-exists/
22
24
  #
@@ -27,7 +29,8 @@ module Elasticsearch
27
29
  :ignore_indices,
28
30
  :ignore_unavailable,
29
31
  :allow_no_indices,
30
- :expand_wildcards
32
+ :expand_wildcards,
33
+ :local
31
34
  ]
32
35
 
33
36
  method = 'HEAD'
@@ -14,7 +14,7 @@ module Elasticsearch
14
14
  # client.indices.get_alias index: 'log*', name: '2013'
15
15
  #
16
16
  # @option arguments [List] :index A comma-separated list of index names to filter aliases
17
- # @option arguments [List] :name A comma-separated list of alias names to return (*Required*)
17
+ # @option arguments [List] :name A comma-separated list of alias names to return
18
18
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
19
19
  # no concrete indices. (This includes `_all` string or when no
20
20
  # indices have been specified)
@@ -24,16 +24,18 @@ module Elasticsearch
24
24
  # `missing` ones (options: none, missing) @until 1.0
25
25
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
26
26
  # unavailable (missing, closed, etc)
27
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
28
+ # (default: false)
27
29
  #
28
30
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
29
31
  #
30
32
  def get_alias(arguments={})
31
- raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
32
33
  valid_params = [
33
34
  :ignore_indices,
34
35
  :ignore_unavailable,
35
36
  :allow_no_indices,
36
- :expand_wildcards
37
+ :expand_wildcards,
38
+ :local
37
39
  ]
38
40
 
39
41
  method = 'GET'
@@ -10,15 +10,18 @@ module Elasticsearch
10
10
  # client.indices.get_aliases
11
11
  #
12
12
  # @option arguments [List] :index A comma-separated list of index names to filter aliases
13
+ # @option arguments [List] :name A comma-separated list of alias names to filter
13
14
  # @option arguments [Time] :timeout Explicit timestamp for the document
15
+ # @option arguments [Boolean] :local Return local information,
16
+ # do not retrieve the state from master node (default: false)
14
17
  #
15
- # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
18
+ # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html
16
19
  #
17
20
  def get_aliases(arguments={})
18
- valid_params = [ :timeout ]
21
+ valid_params = [ :timeout, :local ]
19
22
 
20
23
  method = 'GET'
21
- path = Utils.__pathify Utils.__listify(arguments[:index]), '_aliases'
24
+ path = Utils.__pathify Utils.__listify(arguments[:index]), '_aliases', Utils.__listify(arguments[:name])
22
25
 
23
26
  params = Utils.__validate_and_extract_params arguments, valid_params
24
27
  body = nil
@@ -46,8 +46,9 @@ module Elasticsearch
46
46
  method = 'GET'
47
47
  path = Utils.__pathify(
48
48
  Utils.__listify(arguments[:index]),
49
+ '_mapping',
49
50
  Utils.__listify(arguments[:type]),
50
- '_mapping', 'field',
51
+ 'field',
51
52
  Utils.__listify(arguments[:field])
52
53
  )
53
54
  params = Utils.__validate_and_extract_params arguments, valid_params
@@ -28,19 +28,24 @@ module Elasticsearch
28
28
  # `missing` ones (options: none, missing) @until 1.0
29
29
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
30
30
  # unavailable (missing, closed, etc)
31
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
32
+ # (default: false)
31
33
  #
32
- # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-get-mapping/
34
+ # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-mapping.html
33
35
  #
34
36
  def get_mapping(arguments={})
35
37
  valid_params = [
36
38
  :ignore_indices,
37
39
  :ignore_unavailable,
38
40
  :allow_no_indices,
39
- :expand_wildcards
41
+ :expand_wildcards,
42
+ :local
40
43
  ]
41
44
 
42
45
  method = 'GET'
43
- path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_mapping'
46
+ path = Utils.__pathify Utils.__listify(arguments[:index]),
47
+ '_mapping',
48
+ Utils.__listify(arguments[:type])
44
49
  params = Utils.__validate_and_extract_params arguments, valid_params
45
50
  body = nil
46
51
 
@@ -23,6 +23,7 @@ module Elasticsearch
23
23
  #
24
24
  # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string
25
25
  # to perform the operation on all indices
26
+ # @option arguments [List] :name The name of the settings that should be included in the response
26
27
  # @option arguments [String] :prefix The prefix all settings must have in order to be included
27
28
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
28
29
  # no concrete indices. (This includes `_all` string or when no
@@ -34,6 +35,8 @@ module Elasticsearch
34
35
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
35
36
  # unavailable (missing, closed, etc)
36
37
  # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
38
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
39
+ # (default: false)
37
40
  #
38
41
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/
39
42
  #
@@ -44,14 +47,16 @@ module Elasticsearch
44
47
  :ignore_unavailable,
45
48
  :allow_no_indices,
46
49
  :expand_wildcards,
47
- :flat_settings
50
+ :flat_settings,
51
+ :local
48
52
  ]
49
53
 
50
54
  method = 'GET'
51
55
  path = Utils.__pathify Utils.__listify(arguments[:index]),
52
56
  Utils.__listify(arguments[:type]),
53
57
  arguments.delete(:prefix),
54
- '_settings'
58
+ '_settings',
59
+ Utils.__escape(arguments[:name])
55
60
  params = Utils.__validate_and_extract_params arguments, valid_params
56
61
  body = nil
57
62
 
@@ -39,8 +39,6 @@ module Elasticsearch
39
39
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/
40
40
  #
41
41
  def get_warmer(arguments={})
42
- raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
43
-
44
42
  valid_params = [
45
43
  :ignore_indices,
46
44
  :ignore_unavailable,
@@ -24,7 +24,6 @@ module Elasticsearch
24
24
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/
25
25
  #
26
26
  def put_alias(arguments={})
27
- raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
28
27
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
29
28
  valid_params = [ :timeout ]
30
29
 
@@ -17,9 +17,17 @@ module Elasticsearch
17
17
  # }
18
18
  # }
19
19
  #
20
+ # @example Update the mapping for a specific type in all indices
21
+ #
22
+ # client.indices.put_mapping type: 'mytype', body: {
23
+ # mytype: {
24
+ # dynamic: 'strict'
25
+ # }
26
+ # }
27
+ #
20
28
  # @option arguments [Hash] :body The mapping definition (*Required*)
21
- # @option arguments [List] :index A comma-separated list of index names; use `_all` to perform the operation
22
- # on all indices (*Required*)
29
+ # @option arguments [List] :index A comma-separated list of index names; use `_all` or omit to
30
+ # update the mapping for all indices
23
31
  # @option arguments [String] :type The name of the document type (*Required*)
24
32
  # @option arguments [Boolean] :ignore_conflicts Specify whether to ignore conflicts while updating the mapping
25
33
  # (default: false)
@@ -38,7 +46,6 @@ module Elasticsearch
38
46
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping/
39
47
  #
40
48
  def put_mapping(arguments={})
41
- raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
42
49
  raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
43
50
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
44
51
 
@@ -53,7 +60,7 @@ module Elasticsearch
53
60
  ]
54
61
 
55
62
  method = 'PUT'
56
- path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__escape(arguments[:type]), '_mapping'
63
+ path = Utils.__pathify Utils.__listify(arguments[:index]), '_mapping', Utils.__escape(arguments[:type])
57
64
 
58
65
  params = Utils.__validate_and_extract_params arguments, valid_params
59
66
  body = arguments[:body]
@@ -38,7 +38,6 @@ module Elasticsearch
38
38
  # @see http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/
39
39
  #
40
40
  def put_warmer(arguments={})
41
- raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
42
41
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
43
42
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
44
43
 
@@ -0,0 +1,58 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Actions
4
+
5
+ # Perform multiple percolate operations in a single request, similar to the {#msearch} API
6
+ #
7
+ # Pass the percolate definitions as header-body pairs in the `:body` argument, as an Array of Hashes.
8
+ #
9
+ # @example Perform two different percolations in a single request
10
+ #
11
+ # client.mpercolate \
12
+ # body: [
13
+ # { percolate: { index: "my-index", type: "my-type" } },
14
+ # { doc: { message: "foo bar" } },
15
+ # { percolate: { index: "my-other-index", type: "my-other-type", id: "1" } },
16
+ # { }
17
+ # ]
18
+ #
19
+ # @option arguments [String] :index The index of the document being count percolated to use as default
20
+ # @option arguments [String] :type The type of the document being percolated to use as default.
21
+ # @option arguments [Array<Hash>] The percolate request definitions (header & body pairs) (*Required*)
22
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
23
+ # unavailable (missing or closed)
24
+ # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
25
+ # no concrete indices. (This includes `_all` string or when no
26
+ # indices have been specified)
27
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are
28
+ # open, closed or both. (options: open, closed)
29
+ #
30
+ # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-percolate.html
31
+ #
32
+ def mpercolate(arguments={})
33
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
34
+ valid_params = [
35
+ :ignore_unavailable,
36
+ :allow_no_indices,
37
+ :expand_wildcards ]
38
+
39
+ method = 'GET'
40
+ path = "_mpercolate"
41
+
42
+ params = Utils.__validate_and_extract_params arguments, valid_params
43
+ body = arguments[:body]
44
+
45
+ case
46
+ when body.is_a?(Array)
47
+ payload = body.map { |d| d.is_a?(String) ? d : MultiJson.dump(d) }
48
+ payload << "" unless payload.empty?
49
+ payload = payload.join("\n")
50
+ else
51
+ payload = body
52
+ end
53
+
54
+ perform_request(method, path, params, payload).body
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,67 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Actions
4
+
5
+ # Returns information and statistics about terms in the fields of multiple documents
6
+ # in a single request/response. The semantics are similar to the {#mget} API.
7
+ #
8
+ # @example Return information about multiple documents in a specific index
9
+ #
10
+ # subject.mtermvectors index: 'my-index', type: 'my-type', body: { ids: [1, 2, 3] }
11
+ #
12
+ # @option arguments [String] :index The name of the index
13
+ # @option arguments [String] :type The type of the document
14
+ # @option arguments [Hash] :body Document identifiers; can be either `docs` (containing full document information)
15
+ # or `ids` (when index and type is provided in the URL (*Required*)
16
+ # @option arguments [List] :ids A comma-separated list of documents ids (alternative to `:body`)
17
+ # @option arguments [Boolean] :term_statistics Whether total term frequency and
18
+ # document frequency should be returned.
19
+ # @option arguments [Boolean] :field_statistics Whether document count, sum of document frequencies
20
+ # and sum of total term frequencies should be returned.
21
+ # @option arguments [List] :fields A comma-separated list of fields to return
22
+ # @option arguments [Boolean] :offsets Whether term offsets should be returned
23
+ # @option arguments [Boolean] :positions Whether term positions should be returned
24
+ # @option arguments [Boolean] :payloads Whether term payloads should be returned
25
+ # @option arguments [String] :preference Specify the node or shard the operation should be performed on
26
+ # (default: random)
27
+ # @option arguments [String] :routing Specific routing value
28
+ # @option arguments [String] :parent Parent ID of documents
29
+ #
30
+ # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html
31
+ #
32
+ # @see #mget
33
+ # @see #termvector
34
+ #
35
+ def mtermvectors(arguments={})
36
+ valid_params = [
37
+ :ids,
38
+ :term_statistics,
39
+ :field_statistics,
40
+ :fields,
41
+ :offsets,
42
+ :positions,
43
+ :payloads,
44
+ :preference,
45
+ :routing,
46
+ :parent ]
47
+
48
+ ids = arguments.delete(:ids)
49
+
50
+ method = 'GET'
51
+ path = Utils.__pathify Utils.__escape(arguments[:index]),
52
+ Utils.__escape(arguments[:type]),
53
+ '_mtermvectors'
54
+
55
+ params = Utils.__validate_and_extract_params arguments, valid_params
56
+
57
+ if ids
58
+ body = { :ids => ids }
59
+ else
60
+ body = arguments[:body]
61
+ end
62
+
63
+ perform_request(method, path, params, body).body
64
+ end
65
+ end
66
+ end
67
+ end
@@ -1,6 +1,6 @@
1
1
  module Elasticsearch
2
2
  module API
3
- module Cluster
3
+ module Nodes
4
4
  module Actions
5
5
 
6
6
  # Returns information about the hottest threads in the cluster or on a specific node as a String.
@@ -11,7 +11,7 @@ module Elasticsearch
11
11
  #
12
12
  # @example Return 10 hottest threads
13
13
  #
14
- # client.cluster.node_hot_threads threads: 10
14
+ # client.nodes.hot_threads threads: 10
15
15
  #
16
16
  # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information;
17
17
  # use `_local` to return information from the node you're connecting to,
@@ -25,7 +25,7 @@ module Elasticsearch
25
25
  #
26
26
  # @see http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-hot-threads/
27
27
  #
28
- def node_hot_threads(arguments={})
28
+ def hot_threads(arguments={})
29
29
  valid_params = [
30
30
  :interval,
31
31
  :snapshots,
@@ -1,6 +1,6 @@
1
1
  module Elasticsearch
2
2
  module API
3
- module Cluster
3
+ module Nodes
4
4
  module Actions
5
5
 
6
6
  # Returns information about nodes in the cluster (cluster settings, JVM version, etc).
@@ -12,7 +12,7 @@ module Elasticsearch
12
12
  #
13
13
  # @example Return information about JVM
14
14
  #
15
- # client.cluster.node_info jvm: true
15
+ # client.nodes.info jvm: true
16
16
  #
17
17
  # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information;
18
18
  # use `_local` to return information from the node you're connecting to, leave
@@ -31,7 +31,7 @@ module Elasticsearch
31
31
  #
32
32
  # @see http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/
33
33
  #
34
- def node_info(arguments={})
34
+ def info(arguments={})
35
35
  valid_params = [
36
36
  :all,
37
37
  :clear,
@@ -1,13 +1,13 @@
1
1
  module Elasticsearch
2
2
  module API
3
- module Cluster
3
+ module Nodes
4
4
  module Actions
5
5
 
6
6
  # Shutdown one or all nodes
7
7
  #
8
8
  # @example Shut down node named _Bloke_
9
9
  #
10
- # client.cluster.node_shutdown node_id: 'Bloke'
10
+ # client.nodes.shutdown node_id: 'Bloke'
11
11
  #
12
12
  # @option arguments [List] :node_id A comma-separated list of node IDs or names to perform the operation on; use
13
13
  # `_local` to shutdown the node you're connected to, leave empty to
@@ -17,7 +17,7 @@ module Elasticsearch
17
17
  #
18
18
  # @see http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/
19
19
  #
20
- def node_shutdown(arguments={})
20
+ def shutdown(arguments={})
21
21
  valid_params = [
22
22
  :delay,
23
23
  :exit ]
@@ -0,0 +1,79 @@
1
+ module Elasticsearch
2
+ module API
3
+ module Nodes
4
+ module Actions
5
+
6
+ # Returns statistical information about nodes in the cluster.
7
+ #
8
+ # @example Return statistics about JVM
9
+ #
10
+ # client.nodes.stats metric: 'jvm'
11
+ #
12
+ # @example Return statistics about field data structures for all fields
13
+ #
14
+ # client.nodes.stats metric: 'indices', index_metric: 'fielddata', fields: '*', human: true
15
+ #
16
+ # @option arguments [List] :metric Limit the information returned to the specified metrics
17
+ # (options: _all, breaker, fs, http, indices, jvm, network,
18
+ # os, process, thread_pool, transport)
19
+ # @option arguments [List] :index_metric Limit the information returned for the `indices` metric
20
+ # to the specified index metrics. Used only when
21
+ # `indices` or `all` metric is specified.
22
+ # (options: _all, completion, docs, fielddata, filter_cache, flush, get,
23
+ # id_cache, indexing, merge, percolate, refresh, search, segments, store,
24
+ # warmer)
25
+ # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit
26
+ # the returned information; use `_local` to return information
27
+ # from the node you're connecting to, leave empty to get information
28
+ # from all nodes
29
+ # @option arguments [List] :completion_fields A comma-separated list of fields for `fielddata` and `suggest`
30
+ # index metrics (supports wildcards)
31
+ # @option arguments [List] :fielddata_fields A comma-separated list of fields for `fielddata` index metric
32
+ # (supports wildcards)
33
+ # @option arguments [List] :fields A comma-separated list of fields for `fielddata` and `completion` index
34
+ # metrics (supports wildcards)
35
+ # @option arguments [Boolean] :groups A comma-separated list of search groups for `search` index metric
36
+ # @option arguments [Boolean] :human Whether to return time and byte values in human-readable format
37
+ # @option arguments [String] :level Specify the level for aggregating indices stats
38
+ # (options: node, indices, shards)
39
+ # @option arguments [List] :types A comma-separated list of document types for the `indexing` index metric
40
+ #
41
+ # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html
42
+ #
43
+ def stats(arguments={})
44
+ arguments = arguments.clone
45
+
46
+ valid_params = [
47
+ :metric,
48
+ :index_metric,
49
+ :node_id,
50
+ :completion_fields,
51
+ :fielddata_fields,
52
+ :fields,
53
+ :groups,
54
+ :human,
55
+ :level,
56
+ :types ]
57
+
58
+ method = 'GET'
59
+
60
+ path = Utils.__pathify '_nodes',
61
+ Utils.__listify(arguments[:node_id]),
62
+ 'stats',
63
+ Utils.__listify(arguments.delete(:metric)),
64
+ Utils.__listify(arguments.delete(:index_metric))
65
+
66
+ params = Utils.__validate_and_extract_params arguments, valid_params
67
+
68
+ [:completion_fields, :fielddata_fields, :fields, :groups, :types].each do |key|
69
+ params[key] = Utils.__listify(params[key]) if params[key]
70
+ end
71
+
72
+ body = nil
73
+
74
+ perform_request(method, path, params, body).body
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end