elasticsearch-api 7.3.0 → 7.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +16 -23
  3. data/elasticsearch-api.gemspec +1 -1
  4. data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -2
  5. data/lib/elasticsearch/api/actions/benchmark.rb +2 -3
  6. data/lib/elasticsearch/api/actions/bulk.rb +35 -68
  7. data/lib/elasticsearch/api/actions/cat/aliases.rb +30 -52
  8. data/lib/elasticsearch/api/actions/cat/allocation.rb +36 -50
  9. data/lib/elasticsearch/api/actions/cat/count.rb +25 -46
  10. data/lib/elasticsearch/api/actions/cat/fielddata.rb +31 -33
  11. data/lib/elasticsearch/api/actions/cat/health.rb +27 -37
  12. data/lib/elasticsearch/api/actions/cat/help.rb +14 -10
  13. data/lib/elasticsearch/api/actions/cat/indices.rb +45 -62
  14. data/lib/elasticsearch/api/actions/cat/master.rb +24 -34
  15. data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +20 -16
  16. data/lib/elasticsearch/api/actions/cat/nodes.rb +34 -46
  17. data/lib/elasticsearch/api/actions/cat/params_registry.rb +0 -1
  18. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +29 -35
  19. data/lib/elasticsearch/api/actions/cat/plugins.rb +21 -18
  20. data/lib/elasticsearch/api/actions/cat/recovery.rb +40 -56
  21. data/lib/elasticsearch/api/actions/cat/repositories.rb +21 -24
  22. data/lib/elasticsearch/api/actions/cat/segments.rb +29 -22
  23. data/lib/elasticsearch/api/actions/cat/shards.rb +38 -59
  24. data/lib/elasticsearch/api/actions/cat/snapshots.rb +32 -27
  25. data/lib/elasticsearch/api/actions/cat/tasks.rb +25 -19
  26. data/lib/elasticsearch/api/actions/cat/templates.rb +26 -18
  27. data/lib/elasticsearch/api/actions/cat/thread_pool.rb +36 -46
  28. data/lib/elasticsearch/api/actions/clear_scroll.rb +21 -8
  29. data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +15 -13
  30. data/lib/elasticsearch/api/actions/cluster/get_settings.rb +18 -18
  31. data/lib/elasticsearch/api/actions/cluster/health.rb +42 -44
  32. data/lib/elasticsearch/api/actions/cluster/params_registry.rb +0 -1
  33. data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +15 -17
  34. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +20 -17
  35. data/lib/elasticsearch/api/actions/cluster/remote_info.rb +8 -6
  36. data/lib/elasticsearch/api/actions/cluster/reroute.rb +25 -37
  37. data/lib/elasticsearch/api/actions/cluster/state.rb +37 -41
  38. data/lib/elasticsearch/api/actions/cluster/stats.rb +20 -12
  39. data/lib/elasticsearch/api/actions/count.rb +52 -39
  40. data/lib/elasticsearch/api/actions/create.rb +25 -26
  41. data/lib/elasticsearch/api/actions/delete.rb +43 -36
  42. data/lib/elasticsearch/api/actions/delete_by_query.rb +74 -62
  43. data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +39 -0
  44. data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +4 -3
  45. data/lib/elasticsearch/api/actions/delete_script.rb +19 -13
  46. data/lib/elasticsearch/api/actions/exists.rb +44 -34
  47. data/lib/elasticsearch/api/actions/exists_source.rb +43 -25
  48. data/lib/elasticsearch/api/actions/explain.rb +46 -51
  49. data/lib/elasticsearch/api/actions/field_caps.rb +27 -20
  50. data/lib/elasticsearch/api/actions/get.rb +42 -41
  51. data/lib/elasticsearch/api/actions/get_script.rb +19 -14
  52. data/lib/elasticsearch/api/actions/get_source.rb +38 -44
  53. data/lib/elasticsearch/api/actions/index.rb +60 -89
  54. data/lib/elasticsearch/api/actions/indices/analyze.rb +19 -48
  55. data/lib/elasticsearch/api/actions/indices/clear_cache.rb +29 -41
  56. data/lib/elasticsearch/api/actions/indices/clone.rb +50 -0
  57. data/lib/elasticsearch/api/actions/indices/close.rb +28 -32
  58. data/lib/elasticsearch/api/actions/indices/create.rb +22 -70
  59. data/lib/elasticsearch/api/actions/indices/delete.rb +23 -35
  60. data/lib/elasticsearch/api/actions/indices/delete_alias.rb +24 -20
  61. data/lib/elasticsearch/api/actions/indices/delete_template.rb +18 -20
  62. data/lib/elasticsearch/api/actions/indices/exists.rb +32 -34
  63. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +33 -29
  64. data/lib/elasticsearch/api/actions/indices/exists_template.rb +21 -16
  65. data/lib/elasticsearch/api/actions/indices/exists_type.rb +29 -29
  66. data/lib/elasticsearch/api/actions/indices/flush.rb +28 -28
  67. data/lib/elasticsearch/api/actions/indices/flush_synced.rb +23 -12
  68. data/lib/elasticsearch/api/actions/indices/forcemerge.rb +26 -41
  69. data/lib/elasticsearch/api/actions/indices/freeze.rb +7 -8
  70. data/lib/elasticsearch/api/actions/indices/get.rb +25 -19
  71. data/lib/elasticsearch/api/actions/indices/get_alias.rb +31 -23
  72. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +42 -38
  73. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +39 -31
  74. data/lib/elasticsearch/api/actions/indices/get_settings.rb +34 -37
  75. data/lib/elasticsearch/api/actions/indices/get_template.rb +21 -23
  76. data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +48 -0
  77. data/lib/elasticsearch/api/actions/indices/open.rb +24 -21
  78. data/lib/elasticsearch/api/actions/indices/params_registry.rb +0 -1
  79. data/lib/elasticsearch/api/actions/indices/put_alias.rb +25 -27
  80. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +40 -39
  81. data/lib/elasticsearch/api/actions/indices/put_settings.rb +30 -37
  82. data/lib/elasticsearch/api/actions/indices/put_template.rb +23 -23
  83. data/lib/elasticsearch/api/actions/indices/recovery.rb +20 -23
  84. data/lib/elasticsearch/api/actions/indices/refresh.rb +22 -26
  85. data/lib/elasticsearch/api/actions/indices/rollover.rb +28 -19
  86. data/lib/elasticsearch/api/actions/indices/segments.rb +24 -17
  87. data/lib/elasticsearch/api/actions/indices/shard_stores.rb +27 -15
  88. data/lib/elasticsearch/api/actions/indices/shrink.rb +23 -17
  89. data/lib/elasticsearch/api/actions/indices/split.rb +23 -17
  90. data/lib/elasticsearch/api/actions/indices/stats.rb +53 -104
  91. data/lib/elasticsearch/api/actions/indices/unfreeze.rb +7 -7
  92. data/lib/elasticsearch/api/actions/indices/update_aliases.rb +15 -32
  93. data/lib/elasticsearch/api/actions/indices/upgrade.rb +26 -16
  94. data/lib/elasticsearch/api/actions/indices/validate_query.rb +46 -59
  95. data/lib/elasticsearch/api/actions/info.rb +9 -6
  96. data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +18 -12
  97. data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +21 -11
  98. data/lib/elasticsearch/api/actions/ingest/params_registry.rb +0 -1
  99. data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +12 -13
  100. data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +19 -14
  101. data/lib/elasticsearch/api/actions/ingest/simulate.rb +23 -13
  102. data/lib/elasticsearch/api/actions/mget.rb +37 -44
  103. data/lib/elasticsearch/api/actions/msearch.rb +54 -54
  104. data/lib/elasticsearch/api/actions/msearch_template.rb +46 -35
  105. data/lib/elasticsearch/api/actions/mtermvectors.rb +39 -35
  106. data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +30 -25
  107. data/lib/elasticsearch/api/actions/nodes/info.rb +29 -63
  108. data/lib/elasticsearch/api/actions/nodes/params_registry.rb +0 -1
  109. data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +24 -22
  110. data/lib/elasticsearch/api/actions/nodes/shutdown.rb +4 -4
  111. data/lib/elasticsearch/api/actions/nodes/stats.rb +43 -36
  112. data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -10
  113. data/lib/elasticsearch/api/actions/params_registry.rb +0 -1
  114. data/lib/elasticsearch/api/actions/ping.rb +12 -13
  115. data/lib/elasticsearch/api/actions/put_script.rb +26 -30
  116. data/lib/elasticsearch/api/actions/rank_eval.rb +24 -15
  117. data/lib/elasticsearch/api/actions/reindex.rb +25 -48
  118. data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +18 -12
  119. data/lib/elasticsearch/api/actions/remote/info.rb +1 -2
  120. data/lib/elasticsearch/api/actions/render_search_template.rb +17 -15
  121. data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +8 -6
  122. data/lib/elasticsearch/api/actions/scroll.rb +28 -51
  123. data/lib/elasticsearch/api/actions/search.rb +104 -165
  124. data/lib/elasticsearch/api/actions/search_shards.rb +31 -28
  125. data/lib/elasticsearch/api/actions/search_template.rb +48 -40
  126. data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +44 -0
  127. data/lib/elasticsearch/api/actions/snapshot/create.rb +22 -29
  128. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +19 -24
  129. data/lib/elasticsearch/api/actions/snapshot/delete.rb +20 -22
  130. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +16 -18
  131. data/lib/elasticsearch/api/actions/snapshot/get.rb +22 -31
  132. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +21 -25
  133. data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +0 -1
  134. data/lib/elasticsearch/api/actions/snapshot/restore.rb +21 -32
  135. data/lib/elasticsearch/api/actions/snapshot/status.rb +23 -24
  136. data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +18 -13
  137. data/lib/elasticsearch/api/actions/tasks/cancel.rb +19 -13
  138. data/lib/elasticsearch/api/actions/tasks/get.rb +16 -13
  139. data/lib/elasticsearch/api/actions/tasks/list.rb +20 -18
  140. data/lib/elasticsearch/api/actions/tasks/params_registry.rb +0 -1
  141. data/lib/elasticsearch/api/actions/termvectors.rb +52 -70
  142. data/lib/elasticsearch/api/actions/update.rb +53 -98
  143. data/lib/elasticsearch/api/actions/update_by_query.rb +77 -66
  144. data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +17 -11
  145. data/lib/elasticsearch/api/version.rb +1 -1
  146. data/spec/elasticsearch/api/actions/cat/segments_spec.rb +9 -11
  147. data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +1 -1
  148. data/spec/elasticsearch/api/actions/count_spec.rb +8 -8
  149. data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +12 -7
  150. data/spec/elasticsearch/api/actions/delete_script_spec.rb +0 -14
  151. data/spec/elasticsearch/api/actions/exists_document_spec.rb +1 -1
  152. data/spec/elasticsearch/api/actions/get_document_source_spec.rb +1 -1
  153. data/spec/elasticsearch/api/actions/index_document_spec.rb +6 -15
  154. data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -4
  155. data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +1 -5
  156. data/spec/elasticsearch/api/actions/indices/clone_spec.rb +109 -0
  157. data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +2 -2
  158. data/spec/elasticsearch/api/actions/indices/get_spec.rb +0 -11
  159. data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +3 -3
  160. data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +3 -3
  161. data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -1
  162. data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +3 -3
  163. data/spec/elasticsearch/api/actions/put_script_spec.rb +20 -15
  164. data/spec/elasticsearch/api/actions/render_search_template_spec.rb +23 -7
  165. data/spec/elasticsearch/api/actions/scroll_spec.rb +37 -0
  166. data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
  167. data/spec/elasticsearch/api/actions/tasks/list_spec.rb +0 -11
  168. data/spec/elasticsearch/api/actions/update_document_spec.rb +3 -7
  169. data/spec/elasticsearch/api/rest_api_yaml_spec.rb +1 -1
  170. data/spec/rest_yaml_tests_helper.rb +12 -0
  171. data/utils/Gemfile +1 -0
  172. data/utils/Thorfile +0 -1
  173. data/utils/thor/generate_source.rb +192 -85
  174. data/utils/thor/generator/endpoint_specifics.rb +157 -0
  175. data/utils/thor/generator/files_helper.rb +37 -0
  176. data/utils/thor/lister.rb +3 -4
  177. data/utils/thor/templates/_documentation_top.erb +27 -0
  178. data/utils/thor/templates/_method_setup.erb +35 -0
  179. data/utils/thor/templates/_params_registry.erb +12 -0
  180. data/utils/thor/templates/_perform_request.erb +37 -0
  181. data/utils/thor/templates/method.erb +59 -0
  182. data/utils/thor/templates/{ruby/test.erb → test.erb} +0 -0
  183. data/utils/thor/templates/{ruby/test_helper.rb → test_helper.rb} +0 -0
  184. metadata +31 -14
  185. data/spec/elasticsearch/api/actions/scoll_spec.rb +0 -21
  186. data/utils/thor/generate_api.rb +0 -193
  187. data/utils/thor/templates/ruby/method.erb +0 -62
@@ -5,17 +5,10 @@
5
5
  module Elasticsearch
6
6
  module API
7
7
  module Actions
8
-
9
- # Returns information and statistics about terms in the fields of multiple documents
10
- # in a single request/response. The semantics are similar to the {#mget} API.
11
- #
12
- # @example Return information about multiple documents in a specific index
13
- #
14
- # subject.mtermvectors index: 'my-index', type: 'my-type', body: { ids: [1, 2, 3] }
8
+ # Returns multiple termvectors in one request.
15
9
  #
16
10
  # @option arguments [String] :index The index in which the document resides.
17
11
  # @option arguments [String] :type The type of the document.
18
- # @option arguments [Hash] :body Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.
19
12
  # @option arguments [List] :ids A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body
20
13
  # @option arguments [Boolean] :term_statistics Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
21
14
  # @option arguments [Boolean] :field_statistics Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
@@ -25,52 +18,63 @@ module Elasticsearch
25
18
  # @option arguments [Boolean] :payloads Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs".
26
19
  # @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs".
27
20
  # @option arguments [String] :routing Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs".
28
- # @option arguments [String] :parent Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs".
29
21
  # @option arguments [Boolean] :realtime Specifies if requests are real-time as opposed to near-real-time (default: true).
30
22
  # @option arguments [Number] :version Explicit version number for concurrency control
31
- # @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
23
+ # @option arguments [String] :version_type Specific version type
24
+ # (options: internal,external,external_gte,force)
25
+
26
+ # @option arguments [Hash] :body Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.
32
27
  #
33
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html
28
+ # *Deprecation notice*:
29
+ # Specifying types in urls has been deprecated
30
+ # Deprecated since version 7.0.0
34
31
  #
35
- # @see #mget
36
- # @see #termvector
37
32
  #
38
- def mtermvectors(arguments={})
33
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-multi-termvectors.html
34
+ #
35
+ def mtermvectors(arguments = {})
36
+ arguments = arguments.clone
39
37
  ids = arguments.delete(:ids)
40
38
 
41
- method = HTTP_GET
42
- path = Utils.__pathify Utils.__escape(arguments[:index]),
43
- Utils.__escape(arguments[:type]),
44
- '_mtermvectors'
39
+ _index = arguments.delete(:index)
40
+
41
+ _type = arguments.delete(:type)
45
42
 
43
+ method = Elasticsearch::API::HTTP_GET
44
+ path = if _index && _type
45
+ "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_mtermvectors"
46
+ elsif _index
47
+ "#{Utils.__listify(_index)}/_mtermvectors"
48
+ else
49
+ "_mtermvectors"
50
+ end
46
51
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
47
52
 
48
53
  if ids
49
54
  body = { :ids => ids }
50
55
  else
51
56
  body = arguments[:body]
52
- end
53
-
57
+ end
54
58
  perform_request(method, path, params, body).body
55
59
  end
56
60
 
57
61
  # Register this action with its valid params when the module is loaded.
58
62
  #
59
- # @since 6.1.1
63
+ # @since 6.2.0
60
64
  ParamsRegistry.register(:mtermvectors, [
61
- :ids,
62
- :term_statistics,
63
- :field_statistics,
64
- :fields,
65
- :offsets,
66
- :positions,
67
- :payloads,
68
- :preference,
69
- :routing,
70
- :parent,
71
- :realtime,
72
- :version,
73
- :version_type ].freeze)
65
+ :ids,
66
+ :term_statistics,
67
+ :field_statistics,
68
+ :fields,
69
+ :offsets,
70
+ :positions,
71
+ :payloads,
72
+ :preference,
73
+ :routing,
74
+ :realtime,
75
+ :version,
76
+ :version_type
77
+ ].freeze)
78
+ end
74
79
  end
75
- end
76
80
  end
@@ -6,50 +6,55 @@ module Elasticsearch
6
6
  module API
7
7
  module Nodes
8
8
  module Actions
9
-
10
- # Returns information about the hottest threads in the cluster or on a specific node as a String.
11
- #
12
- #
13
- # The information is returned as text, and allows you to understand what are currently
14
- # the most taxing operations happening in the cluster, for debugging or monitoring purposes.
15
- #
16
- # @example Return 10 hottest threads
17
- #
18
- # client.nodes.hot_threads threads: 10
9
+ # Returns information about hot threads on each node in the cluster.
19
10
  #
20
11
  # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
21
12
  # @option arguments [Time] :interval The interval for the second sampling of threads
22
13
  # @option arguments [Number] :snapshots Number of samples of thread stacktrace (default: 10)
23
14
  # @option arguments [Number] :threads Specify the number of threads to provide information for (default: 3)
24
15
  # @option arguments [Boolean] :ignore_idle_threads Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true)
25
- # @option arguments [String] :type The type to sample (default: cpu) (options: cpu, wait, block)
16
+ # @option arguments [String] :type The type to sample (default: cpu)
17
+ # (options: cpu,wait,block)
18
+
26
19
  # @option arguments [Time] :timeout Explicit operation timeout
20
+
27
21
  #
28
- # @return [String]
22
+ # *Deprecation notice*:
23
+ # The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons
24
+ # Deprecated since version 7.0.0
29
25
  #
30
- # @see https://www.elastic.co/guide/reference/api/admin-cluster-nodes-hot-threads/
31
26
  #
32
- def hot_threads(arguments={})
33
- method = HTTP_GET
34
- path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'hot_threads'
27
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cluster-nodes-hot-threads.html
28
+ #
29
+ def hot_threads(arguments = {})
30
+ arguments = arguments.clone
31
+
32
+ _node_id = arguments.delete(:node_id)
35
33
 
34
+ method = Elasticsearch::API::HTTP_GET
35
+ path = if _node_id
36
+ "_cluster/nodes/#{Utils.__listify(_node_id)}/hot_threads"
37
+ else
38
+ "_cluster/nodes/hot_threads"
39
+ end
36
40
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
37
- body = nil
38
41
 
42
+ body = nil
39
43
  perform_request(method, path, params, body).body
40
44
  end
41
45
 
42
46
  # Register this action with its valid params when the module is loaded.
43
47
  #
44
- # @since 6.1.1
48
+ # @since 6.2.0
45
49
  ParamsRegistry.register(:hot_threads, [
46
- :interval,
47
- :snapshots,
48
- :threads,
49
- :ignore_idle_threads,
50
- :type,
51
- :timeout ].freeze)
50
+ :interval,
51
+ :snapshots,
52
+ :threads,
53
+ :ignore_idle_threads,
54
+ :type,
55
+ :timeout
56
+ ].freeze)
57
+ end
52
58
  end
53
- end
54
59
  end
55
60
  end
@@ -6,83 +6,49 @@ module Elasticsearch
6
6
  module API
7
7
  module Nodes
8
8
  module Actions
9
-
10
- # Returns information about nodes in the cluster (cluster settings, JVM version, etc).
11
- #
12
- # Use the `all` option to return all available settings, or limit the information returned
13
- # to a specific type (eg. `http`).
14
- #
15
- # Use the `node_id` option to limit information to specific node(s).
16
- #
17
- # @example Return information about JVM
18
- #
19
- # client.nodes.info jvm: true
20
- #
21
- # @example Return information about HTTP and network
22
- #
23
- # client.nodes.info http: true, network: true
24
- #
25
- # @example Pass a list of metrics
9
+ # Returns information about nodes in the cluster.
26
10
  #
27
- # client.nodes.info metric: ['http', 'network']
28
- #
29
- # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information;
30
- # use `_local` to return information from the node you're connecting to, leave
31
- # empty to get information from all nodes
32
- # @option arguments [Boolean] :_all Return all available information
33
- # @option arguments [Boolean] :http Return information about HTTP
34
- # @option arguments [Boolean] :jvm Return information about the JVM
35
- # @option arguments [Boolean] :network Return information about network
36
- # @option arguments [Boolean] :os Return information about the operating system
37
- # @option arguments [Boolean] :plugins Return information about plugins
38
- # @option arguments [Boolean] :process Return information about the Elasticsearch process
39
- # @option arguments [Boolean] :settings Return information about node settings
40
- # @option arguments [Boolean] :thread_pool Return information about the thread pool
41
- # @option arguments [Boolean] :transport Return information about transport
11
+ # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
12
+ # @option arguments [List] :metric A comma-separated list of metrics you wish returned. Leave empty to return all.
13
+ # (options: settings,os,process,jvm,thread_pool,transport,http,plugins,ingest)
14
+
42
15
  # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
43
16
  # @option arguments [Time] :timeout Explicit operation timeout
17
+
44
18
  #
45
- # @see http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/
19
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cluster-nodes-info.html
46
20
  #
47
- def info(arguments={})
21
+ def info(arguments = {})
48
22
  arguments = arguments.clone
49
- metric = arguments.delete(:metric)
50
- method = HTTP_GET
51
- if metric
52
- parts = metric
53
- else
54
- parts = Utils.__extract_parts arguments, ParamsRegistry.get(:info_parts)
55
- end
56
23
 
57
- path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), Utils.__listify(parts)
24
+ _node_id = arguments.delete(:node_id)
25
+
26
+ _metric = arguments.delete(:metric)
58
27
 
59
- params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(:info_params)
60
- body = nil
28
+ method = Elasticsearch::API::HTTP_GET
29
+ path = if _node_id && _metric
30
+ "_nodes/#{Utils.__listify(_node_id)}/#{Utils.__listify(_metric)}"
31
+ elsif _node_id
32
+ "_nodes/#{Utils.__listify(_node_id)}"
33
+ elsif _metric
34
+ "_nodes/#{Utils.__listify(_metric)}"
35
+ else
36
+ "_nodes"
37
+ end
38
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
61
39
 
40
+ body = nil
62
41
  perform_request(method, path, params, body).body
63
42
  end
64
43
 
65
44
  # Register this action with its valid params when the module is loaded.
66
45
  #
67
- # @since 6.1.1
68
- ParamsRegistry.register(:info_params, [ :flat_settings, :timeout ].freeze)
69
-
70
- # Register this action with its valid parts when the module is loaded.
71
- #
72
- # @since 6.1.1
73
- ParamsRegistry.register(:info_parts, [
74
- :_all,
75
- :http,
76
- :jvm,
77
- :network,
78
- :os,
79
- :plugins,
80
- :process,
81
- :settings,
82
- :thread_pool,
83
- :transport,
84
- :timeout ].freeze)
46
+ # @since 6.2.0
47
+ ParamsRegistry.register(:info, [
48
+ :flat_settings,
49
+ :timeout
50
+ ].freeze)
51
+ end
85
52
  end
86
- end
87
53
  end
88
54
  end
@@ -7,7 +7,6 @@ module Elasticsearch
7
7
  module Nodes
8
8
  module Actions
9
9
  module ParamsRegistry
10
-
11
10
  extend self
12
11
 
13
12
  # A Mapping of all the actions to their list of valid params.
@@ -6,36 +6,38 @@ module Elasticsearch
6
6
  module API
7
7
  module Nodes
8
8
  module Actions
9
-
10
- # Re-read the local node's encrypted keystore. Specifically, it will prompt the keystore
11
- # decryption and reading across the cluster.
12
- #
13
- # @example Reload secure settings for all nodes
14
- #
15
- # client.nodes.reload_secure_settings
16
- #
17
- # @example Reload secure settings for a list of nodes
18
- #
19
- # client.nodes.reload_secure_settings(node_id: 'foo,bar')
9
+ # Reloads secure settings.
20
10
  #
21
- # @option arguments [ Array ] :node_id A comma-separated list of node IDs or names to perform the operation on
22
- # @option arguments [ String ] :timeout Explicit operation timeout
11
+ # @option arguments [List] :node_id A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes.
12
+ # @option arguments [Time] :timeout Explicit operation timeout
13
+
23
14
  #
24
- # @see http://elasticsearch.org/guide/reference/api/cluster-nodes-reload-secure-settings
15
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/secure-settings.html#reloadable-secure-settings
25
16
  #
26
- def reload_secure_settings(arguments={})
27
- valid_params = [
28
- :timeout ]
17
+ def reload_secure_settings(arguments = {})
18
+ arguments = arguments.clone
29
19
 
30
- method = HTTP_POST
31
- path = Utils.__pathify '_nodes', Utils.__listify(arguments[:node_id]), 'reload_secure_settings'
20
+ _node_id = arguments.delete(:node_id)
32
21
 
33
- params = Utils.__validate_and_extract_params arguments, valid_params
34
- body = nil
22
+ method = Elasticsearch::API::HTTP_POST
23
+ path = if _node_id
24
+ "_nodes/#{Utils.__listify(_node_id)}/reload_secure_settings"
25
+ else
26
+ "_nodes/reload_secure_settings"
27
+ end
28
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
35
29
 
30
+ body = nil
36
31
  perform_request(method, path, params, body).body
37
32
  end
33
+
34
+ # Register this action with its valid params when the module is loaded.
35
+ #
36
+ # @since 6.2.0
37
+ ParamsRegistry.register(:reload_secure_settings, [
38
+ :timeout
39
+ ].freeze)
40
+ end
38
41
  end
39
- end
40
42
  end
41
43
  end
@@ -6,7 +6,6 @@ module Elasticsearch
6
6
  module API
7
7
  module Nodes
8
8
  module Actions
9
-
10
9
  # Shutdown one or all nodes
11
10
  #
12
11
  # @example Shut down node named _Bloke_
@@ -21,7 +20,7 @@ module Elasticsearch
21
20
  #
22
21
  # @see http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/
23
22
  #
24
- def shutdown(arguments={})
23
+ def shutdown(arguments = {})
25
24
  method = HTTP_POST
26
25
  path = Utils.__pathify '_cluster/nodes', Utils.__listify(arguments[:node_id]), '_shutdown'
27
26
 
@@ -35,8 +34,9 @@ module Elasticsearch
35
34
  #
36
35
  # @since 6.1.1
37
36
  ParamsRegistry.register(:shutdown, [
38
- :delay,
39
- :exit ].freeze)
37
+ :delay,
38
+ :exit
39
+ ].freeze)
40
40
  end
41
41
  end
42
42
  end
@@ -6,65 +6,72 @@ module Elasticsearch
6
6
  module API
7
7
  module Nodes
8
8
  module Actions
9
-
10
9
  # Returns statistical information about nodes in the cluster.
11
10
  #
12
- # @example Return statistics about JVM
13
- #
14
- # client.nodes.stats metric: 'jvm'
15
- #
16
- # @example Return statistics about field data structures for all fields
17
- #
18
- # client.nodes.stats metric: 'indices', index_metric: 'fielddata', fields: '*', human: true
19
- #
20
- # @option arguments [List] :metric Limit the information returned to the specified metrics (options: _all,breaker,fs,http,indices,jvm,os,process,thread_pool,transport,discovery)
21
- # @option arguments [List] :index_metric Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. (options: _all,completion,docs,fielddata,query_cache,flush,get,indexing,merge,request_cache,refresh,search,segments,store,warmer,suggest)
22
11
  # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
12
+ # @option arguments [List] :metric Limit the information returned to the specified metrics
13
+ # (options: _all,breaker,fs,http,indices,jvm,os,process,thread_pool,transport,discovery)
14
+
15
+ # @option arguments [List] :index_metric Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified.
16
+ # (options: _all,completion,docs,fielddata,query_cache,flush,get,indexing,merge,request_cache,refresh,search,segments,store,warmer,suggest)
17
+
23
18
  # @option arguments [List] :completion_fields A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)
24
19
  # @option arguments [List] :fielddata_fields A comma-separated list of fields for `fielddata` index metric (supports wildcards)
25
20
  # @option arguments [List] :fields A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)
26
21
  # @option arguments [Boolean] :groups A comma-separated list of search groups for `search` index metric
27
- # @option arguments [String] :level Return indices stats aggregated at index, node or shard level (options: indices, node, shards)
22
+ # @option arguments [String] :level Return indices stats aggregated at index, node or shard level
23
+ # (options: indices,node,shards)
24
+
28
25
  # @option arguments [List] :types A comma-separated list of document types for the `indexing` index metric
29
26
  # @option arguments [Time] :timeout Explicit operation timeout
30
27
  # @option arguments [Boolean] :include_segment_file_sizes Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)
28
+
31
29
  #
32
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html
30
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cluster-nodes-stats.html
33
31
  #
34
- def stats(arguments={})
32
+ def stats(arguments = {})
35
33
  arguments = arguments.clone
36
- node_id = arguments.delete(:node_id)
37
34
 
38
- path = Utils.__pathify '_nodes',
39
- Utils.__listify(node_id),
40
- 'stats',
41
- Utils.__listify(arguments.delete(:metric)),
42
- Utils.__listify(arguments.delete(:index_metric))
35
+ _node_id = arguments.delete(:node_id)
43
36
 
44
- params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
37
+ _metric = arguments.delete(:metric)
45
38
 
46
- [:completion_fields, :fielddata_fields, :fields, :groups, :types].each do |key|
47
- params[key] = Utils.__listify(params[key]) if params[key]
48
- end
39
+ _index_metric = arguments.delete(:index_metric)
49
40
 
50
- body = nil
41
+ method = Elasticsearch::API::HTTP_GET
42
+ path = if _node_id && _metric && _index_metric
43
+ "_nodes/#{Utils.__listify(_node_id)}/stats/#{Utils.__listify(_metric)}/#{Utils.__listify(_index_metric)}"
44
+ elsif _metric && _index_metric
45
+ "_nodes/stats/#{Utils.__listify(_metric)}/#{Utils.__listify(_index_metric)}"
46
+ elsif _node_id && _metric
47
+ "_nodes/#{Utils.__listify(_node_id)}/stats/#{Utils.__listify(_metric)}"
48
+ elsif _node_id
49
+ "_nodes/#{Utils.__listify(_node_id)}/stats"
50
+ elsif _metric
51
+ "_nodes/stats/#{Utils.__listify(_metric)}"
52
+ else
53
+ "_nodes/stats"
54
+ end
55
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
51
56
 
52
- perform_request(HTTP_GET, path, params, body).body
57
+ body = nil
58
+ perform_request(method, path, params, body).body
53
59
  end
54
60
 
55
61
  # Register this action with its valid params when the module is loaded.
56
62
  #
57
- # @since 6.1.1
63
+ # @since 6.2.0
58
64
  ParamsRegistry.register(:stats, [
59
- :completion_fields,
60
- :fielddata_fields,
61
- :fields,
62
- :groups,
63
- :level,
64
- :types,
65
- :timeout,
66
- :include_segment_file_sizes ].freeze)
65
+ :completion_fields,
66
+ :fielddata_fields,
67
+ :fields,
68
+ :groups,
69
+ :level,
70
+ :types,
71
+ :timeout,
72
+ :include_segment_file_sizes
73
+ ].freeze)
74
+ end
67
75
  end
68
- end
69
76
  end
70
77
  end
@@ -1,22 +1,42 @@
1
+ # Licensed to Elasticsearch B.V under one or more agreements.
2
+ # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
+ # See the LICENSE file in the project root for more information
4
+
1
5
  module Elasticsearch
2
6
  module API
3
7
  module Nodes
4
8
  module Actions
5
-
6
- # The cluster nodes usage API allows to retrieve information on the usage of features for each node.
9
+ # Returns low-level information about REST actions usage on nodes.
7
10
  #
8
- # @option arguments [List] :metric Limit the information returned to the specified metrics (options: _all,rest_actions)
9
11
  # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
12
+ # @option arguments [List] :metric Limit the information returned to the specified metrics
13
+ # (options: _all,rest_actions)
14
+
10
15
  # @option arguments [Time] :timeout Explicit operation timeout
16
+
11
17
  #
12
- # @see http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-usage.html
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cluster-nodes-usage.html
13
19
  #
14
- def usage(arguments={})
20
+ def usage(arguments = {})
21
+ arguments = arguments.clone
22
+
23
+ _node_id = arguments.delete(:node_id)
24
+
25
+ _metric = arguments.delete(:metric)
26
+
15
27
  method = Elasticsearch::API::HTTP_GET
16
- path = "_nodes/usage"
17
- params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
18
- body = nil
28
+ path = if _node_id && _metric
29
+ "_nodes/#{Utils.__listify(_node_id)}/usage/#{Utils.__listify(_metric)}"
30
+ elsif _node_id
31
+ "_nodes/#{Utils.__listify(_node_id)}/usage"
32
+ elsif _metric
33
+ "_nodes/usage/#{Utils.__listify(_metric)}"
34
+ else
35
+ "_nodes/usage"
36
+ end
37
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
19
38
 
39
+ body = nil
20
40
  perform_request(method, path, params, body).body
21
41
  end
22
42
 
@@ -24,8 +44,9 @@ module Elasticsearch
24
44
  #
25
45
  # @since 6.2.0
26
46
  ParamsRegistry.register(:usage, [
27
- :timeout ].freeze)
47
+ :timeout
48
+ ].freeze)
49
+ end
28
50
  end
29
- end
30
51
  end
31
52
  end
@@ -6,7 +6,6 @@ module Elasticsearch
6
6
  module API
7
7
  module Actions
8
8
  module ParamsRegistry
9
-
10
9
  extend self
11
10
 
12
11
  # A Mapping of all the actions to their list of valid params.
@@ -5,31 +5,30 @@
5
5
  module Elasticsearch
6
6
  module API
7
7
  module Actions
8
-
9
- # Returns true if the cluster returns a successful HTTP response, false otherwise.
10
- #
11
- # @example
8
+ # Returns whether the cluster is running.
12
9
  #
13
- # client.ping
10
+
14
11
  #
15
- # @see http://elasticsearch.org/guide/
12
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/index.html
16
13
  #
17
- def ping(arguments={})
18
- method = HTTP_HEAD
14
+ def ping(arguments = {})
15
+ arguments = arguments.clone
16
+
17
+ method = Elasticsearch::API::HTTP_HEAD
19
18
  path = ""
20
19
  params = {}
21
- body = nil
22
20
 
21
+ body = nil
23
22
  begin
24
- perform_request(method, path, params, body).status == 200 ? true : false
23
+ perform_request(method, path, params, body).status == 200 ? true : false
25
24
  rescue Exception => e
26
- if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not\s*Found|404|ConnectionFailed/i
25
+ if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not *Found|404|ConnectionFailed/i
27
26
  false
28
27
  else
29
28
  raise e
30
29
  end
31
- end
32
30
  end
31
+ end
32
+ end
33
33
  end
34
- end
35
34
  end