elasticsearch-api 7.4.0 → 7.5.0.pre.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +16 -23
  3. data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -2
  4. data/lib/elasticsearch/api/actions/benchmark.rb +2 -3
  5. data/lib/elasticsearch/api/actions/bulk.rb +35 -68
  6. data/lib/elasticsearch/api/actions/cat/aliases.rb +30 -52
  7. data/lib/elasticsearch/api/actions/cat/allocation.rb +36 -50
  8. data/lib/elasticsearch/api/actions/cat/count.rb +25 -46
  9. data/lib/elasticsearch/api/actions/cat/fielddata.rb +31 -33
  10. data/lib/elasticsearch/api/actions/cat/health.rb +27 -37
  11. data/lib/elasticsearch/api/actions/cat/help.rb +14 -10
  12. data/lib/elasticsearch/api/actions/cat/indices.rb +45 -62
  13. data/lib/elasticsearch/api/actions/cat/master.rb +24 -34
  14. data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +20 -16
  15. data/lib/elasticsearch/api/actions/cat/nodes.rb +34 -46
  16. data/lib/elasticsearch/api/actions/cat/params_registry.rb +0 -1
  17. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +29 -35
  18. data/lib/elasticsearch/api/actions/cat/plugins.rb +21 -18
  19. data/lib/elasticsearch/api/actions/cat/recovery.rb +40 -56
  20. data/lib/elasticsearch/api/actions/cat/repositories.rb +21 -24
  21. data/lib/elasticsearch/api/actions/cat/segments.rb +29 -22
  22. data/lib/elasticsearch/api/actions/cat/shards.rb +38 -59
  23. data/lib/elasticsearch/api/actions/cat/snapshots.rb +32 -27
  24. data/lib/elasticsearch/api/actions/cat/tasks.rb +25 -19
  25. data/lib/elasticsearch/api/actions/cat/templates.rb +26 -18
  26. data/lib/elasticsearch/api/actions/cat/thread_pool.rb +36 -46
  27. data/lib/elasticsearch/api/actions/clear_scroll.rb +21 -8
  28. data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +15 -13
  29. data/lib/elasticsearch/api/actions/cluster/get_settings.rb +18 -18
  30. data/lib/elasticsearch/api/actions/cluster/health.rb +42 -44
  31. data/lib/elasticsearch/api/actions/cluster/params_registry.rb +0 -1
  32. data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +15 -17
  33. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +20 -17
  34. data/lib/elasticsearch/api/actions/cluster/remote_info.rb +8 -6
  35. data/lib/elasticsearch/api/actions/cluster/reroute.rb +25 -37
  36. data/lib/elasticsearch/api/actions/cluster/state.rb +37 -41
  37. data/lib/elasticsearch/api/actions/cluster/stats.rb +20 -12
  38. data/lib/elasticsearch/api/actions/count.rb +52 -39
  39. data/lib/elasticsearch/api/actions/create.rb +25 -26
  40. data/lib/elasticsearch/api/actions/delete.rb +43 -36
  41. data/lib/elasticsearch/api/actions/delete_by_query.rb +74 -62
  42. data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +39 -0
  43. data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +4 -3
  44. data/lib/elasticsearch/api/actions/delete_script.rb +19 -13
  45. data/lib/elasticsearch/api/actions/exists.rb +44 -34
  46. data/lib/elasticsearch/api/actions/exists_source.rb +43 -25
  47. data/lib/elasticsearch/api/actions/explain.rb +46 -51
  48. data/lib/elasticsearch/api/actions/field_caps.rb +27 -20
  49. data/lib/elasticsearch/api/actions/get.rb +42 -41
  50. data/lib/elasticsearch/api/actions/get_script.rb +19 -14
  51. data/lib/elasticsearch/api/actions/get_source.rb +38 -44
  52. data/lib/elasticsearch/api/actions/index.rb +60 -89
  53. data/lib/elasticsearch/api/actions/indices/analyze.rb +19 -48
  54. data/lib/elasticsearch/api/actions/indices/clear_cache.rb +29 -41
  55. data/lib/elasticsearch/api/actions/indices/clone.rb +21 -21
  56. data/lib/elasticsearch/api/actions/indices/close.rb +28 -32
  57. data/lib/elasticsearch/api/actions/indices/create.rb +22 -70
  58. data/lib/elasticsearch/api/actions/indices/delete.rb +23 -35
  59. data/lib/elasticsearch/api/actions/indices/delete_alias.rb +24 -20
  60. data/lib/elasticsearch/api/actions/indices/delete_template.rb +18 -20
  61. data/lib/elasticsearch/api/actions/indices/exists.rb +32 -34
  62. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +33 -29
  63. data/lib/elasticsearch/api/actions/indices/exists_template.rb +21 -16
  64. data/lib/elasticsearch/api/actions/indices/exists_type.rb +29 -29
  65. data/lib/elasticsearch/api/actions/indices/flush.rb +28 -28
  66. data/lib/elasticsearch/api/actions/indices/flush_synced.rb +23 -12
  67. data/lib/elasticsearch/api/actions/indices/forcemerge.rb +26 -41
  68. data/lib/elasticsearch/api/actions/indices/freeze.rb +7 -8
  69. data/lib/elasticsearch/api/actions/indices/get.rb +25 -19
  70. data/lib/elasticsearch/api/actions/indices/get_alias.rb +31 -23
  71. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +42 -38
  72. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +39 -31
  73. data/lib/elasticsearch/api/actions/indices/get_settings.rb +34 -37
  74. data/lib/elasticsearch/api/actions/indices/get_template.rb +21 -23
  75. data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +48 -0
  76. data/lib/elasticsearch/api/actions/indices/open.rb +24 -21
  77. data/lib/elasticsearch/api/actions/indices/params_registry.rb +0 -1
  78. data/lib/elasticsearch/api/actions/indices/put_alias.rb +25 -27
  79. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +40 -39
  80. data/lib/elasticsearch/api/actions/indices/put_settings.rb +30 -37
  81. data/lib/elasticsearch/api/actions/indices/put_template.rb +23 -23
  82. data/lib/elasticsearch/api/actions/indices/recovery.rb +20 -23
  83. data/lib/elasticsearch/api/actions/indices/refresh.rb +22 -26
  84. data/lib/elasticsearch/api/actions/indices/rollover.rb +28 -19
  85. data/lib/elasticsearch/api/actions/indices/segments.rb +24 -17
  86. data/lib/elasticsearch/api/actions/indices/shard_stores.rb +27 -15
  87. data/lib/elasticsearch/api/actions/indices/shrink.rb +23 -17
  88. data/lib/elasticsearch/api/actions/indices/split.rb +23 -17
  89. data/lib/elasticsearch/api/actions/indices/stats.rb +53 -104
  90. data/lib/elasticsearch/api/actions/indices/unfreeze.rb +7 -7
  91. data/lib/elasticsearch/api/actions/indices/update_aliases.rb +15 -32
  92. data/lib/elasticsearch/api/actions/indices/upgrade.rb +26 -16
  93. data/lib/elasticsearch/api/actions/indices/validate_query.rb +46 -59
  94. data/lib/elasticsearch/api/actions/info.rb +9 -6
  95. data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +18 -12
  96. data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +21 -11
  97. data/lib/elasticsearch/api/actions/ingest/params_registry.rb +0 -1
  98. data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +12 -13
  99. data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +19 -14
  100. data/lib/elasticsearch/api/actions/ingest/simulate.rb +23 -13
  101. data/lib/elasticsearch/api/actions/mget.rb +37 -44
  102. data/lib/elasticsearch/api/actions/msearch.rb +54 -54
  103. data/lib/elasticsearch/api/actions/msearch_template.rb +46 -35
  104. data/lib/elasticsearch/api/actions/mtermvectors.rb +39 -35
  105. data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +30 -25
  106. data/lib/elasticsearch/api/actions/nodes/info.rb +29 -63
  107. data/lib/elasticsearch/api/actions/nodes/params_registry.rb +0 -1
  108. data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +24 -22
  109. data/lib/elasticsearch/api/actions/nodes/shutdown.rb +4 -4
  110. data/lib/elasticsearch/api/actions/nodes/stats.rb +43 -36
  111. data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -10
  112. data/lib/elasticsearch/api/actions/params_registry.rb +0 -1
  113. data/lib/elasticsearch/api/actions/ping.rb +12 -13
  114. data/lib/elasticsearch/api/actions/put_script.rb +26 -30
  115. data/lib/elasticsearch/api/actions/rank_eval.rb +24 -15
  116. data/lib/elasticsearch/api/actions/reindex.rb +25 -48
  117. data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +18 -12
  118. data/lib/elasticsearch/api/actions/remote/info.rb +1 -2
  119. data/lib/elasticsearch/api/actions/render_search_template.rb +17 -15
  120. data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +8 -6
  121. data/lib/elasticsearch/api/actions/scroll.rb +28 -51
  122. data/lib/elasticsearch/api/actions/search.rb +104 -165
  123. data/lib/elasticsearch/api/actions/search_shards.rb +31 -28
  124. data/lib/elasticsearch/api/actions/search_template.rb +48 -40
  125. data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +44 -0
  126. data/lib/elasticsearch/api/actions/snapshot/create.rb +22 -29
  127. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +19 -24
  128. data/lib/elasticsearch/api/actions/snapshot/delete.rb +20 -22
  129. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +16 -18
  130. data/lib/elasticsearch/api/actions/snapshot/get.rb +22 -31
  131. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +21 -25
  132. data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +0 -1
  133. data/lib/elasticsearch/api/actions/snapshot/restore.rb +21 -32
  134. data/lib/elasticsearch/api/actions/snapshot/status.rb +23 -24
  135. data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +18 -13
  136. data/lib/elasticsearch/api/actions/tasks/cancel.rb +19 -13
  137. data/lib/elasticsearch/api/actions/tasks/get.rb +16 -13
  138. data/lib/elasticsearch/api/actions/tasks/list.rb +20 -18
  139. data/lib/elasticsearch/api/actions/tasks/params_registry.rb +0 -1
  140. data/lib/elasticsearch/api/actions/termvectors.rb +52 -70
  141. data/lib/elasticsearch/api/actions/update.rb +53 -98
  142. data/lib/elasticsearch/api/actions/update_by_query.rb +77 -66
  143. data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +17 -11
  144. data/lib/elasticsearch/api/version.rb +1 -1
  145. data/spec/elasticsearch/api/actions/cat/segments_spec.rb +9 -11
  146. data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +1 -1
  147. data/spec/elasticsearch/api/actions/count_spec.rb +8 -8
  148. data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +12 -7
  149. data/spec/elasticsearch/api/actions/delete_script_spec.rb +0 -14
  150. data/spec/elasticsearch/api/actions/exists_document_spec.rb +1 -1
  151. data/spec/elasticsearch/api/actions/get_document_source_spec.rb +1 -1
  152. data/spec/elasticsearch/api/actions/index_document_spec.rb +6 -15
  153. data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -4
  154. data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +1 -5
  155. data/spec/elasticsearch/api/actions/indices/clone_spec.rb +1 -1
  156. data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +2 -2
  157. data/spec/elasticsearch/api/actions/indices/get_spec.rb +0 -11
  158. data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +3 -3
  159. data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +3 -3
  160. data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -1
  161. data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +3 -3
  162. data/spec/elasticsearch/api/actions/put_script_spec.rb +20 -15
  163. data/spec/elasticsearch/api/actions/render_search_template_spec.rb +23 -7
  164. data/spec/elasticsearch/api/actions/scroll_spec.rb +37 -0
  165. data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
  166. data/spec/elasticsearch/api/actions/tasks/list_spec.rb +0 -11
  167. data/spec/elasticsearch/api/actions/update_document_spec.rb +3 -7
  168. data/spec/rest_yaml_tests_helper.rb +12 -0
  169. data/utils/Gemfile +1 -0
  170. data/utils/Thorfile +0 -1
  171. data/utils/thor/generate_source.rb +192 -85
  172. data/utils/thor/generator/endpoint_specifics.rb +157 -0
  173. data/utils/thor/generator/files_helper.rb +37 -0
  174. data/utils/thor/lister.rb +3 -4
  175. data/utils/thor/templates/_documentation_top.erb +27 -0
  176. data/utils/thor/templates/_method_setup.erb +35 -0
  177. data/utils/thor/templates/_params_registry.erb +12 -0
  178. data/utils/thor/templates/_perform_request.erb +37 -0
  179. data/utils/thor/templates/method.erb +59 -0
  180. data/utils/thor/templates/{ruby/test.erb → test.erb} +0 -0
  181. data/utils/thor/templates/{ruby/test_helper.rb → test_helper.rb} +0 -0
  182. metadata +19 -11
  183. data/spec/elasticsearch/api/actions/scoll_spec.rb +0 -21
  184. data/utils/thor/generate_api.rb +0 -193
  185. data/utils/thor/templates/ruby/method.erb +0 -62
@@ -6,68 +6,47 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Return document counts for the entire cluster or specific indices
11
- #
12
- # @example Display number of documents in the cluster
13
- #
14
- # puts client.cat.count
15
- #
16
- # @example Display number of documents in an index
17
- #
18
- # puts client.cat.count index: 'index-a'
19
- #
20
- # @example Display number of documents in a list of indices
21
- #
22
- # puts client.cat.count index: ['index-a', 'index-b']
23
- #
24
- # @example Display header names in the output
25
- #
26
- # puts client.cat.count v: true
27
- #
28
- # @example Return the information as Ruby objects
29
- #
30
- # client.cat.count format: 'json'
9
+ # Provides quick access to the document count of the entire cluster, or individual indices.
31
10
  #
32
11
  # @option arguments [List] :index A comma-separated list of index names to limit the returned information
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
12
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
13
+ # @option arguments [List] :h Comma-separated list of column names to display
14
+ # @option arguments [Boolean] :help Return help information
35
15
  # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
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
16
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
17
+
41
18
  #
42
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html
19
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat-count.html
43
20
  #
44
- def count(arguments={})
45
- index = arguments.delete(:index)
21
+ def count(arguments = {})
22
+ arguments = arguments.clone
46
23
 
47
- method = HTTP_GET
48
-
49
- path = Utils.__pathify '_cat/count', Utils.__listify(index)
24
+ _index = arguments.delete(:index)
50
25
 
26
+ method = Elasticsearch::API::HTTP_GET
27
+ path = if _index
28
+ "_cat/count/#{Utils.__listify(_index)}"
29
+ else
30
+ "_cat/count"
31
+ end
51
32
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
52
33
  params[:h] = Utils.__listify(params[:h]) if params[:h]
53
34
 
54
- body = nil
55
-
35
+ body = nil
56
36
  perform_request(method, path, params, body).body
57
37
  end
58
38
 
59
39
  # Register this action with its valid params when the module is loaded.
60
40
  #
61
- # @since 6.1.1
41
+ # @since 6.2.0
62
42
  ParamsRegistry.register(:count, [
63
- :format,
64
- :local,
65
- :master_timeout,
66
- :h,
67
- :help,
68
- :s,
69
- :v ].freeze)
43
+ :format,
44
+ :h,
45
+ :help,
46
+ :s,
47
+ :v
48
+ ].freeze)
49
+ end
70
50
  end
71
- end
72
51
  end
73
52
  end
@@ -6,54 +6,52 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Return information about field data usage across the cluster
11
- #
12
- # @example Return the total size of field data
13
- #
14
- # client.cat.fielddata
9
+ # Shows how much heap memory is currently being used by fielddata on every data node in the cluster.
15
10
  #
16
- # @example Return both the total size and size for specific fields
17
- #
18
- # client.cat.fielddata fields: 'title,body'
19
- #
20
- # @option arguments [List] :fields A comma-separated list of fields to include in the output
21
- # @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
22
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
23
- # (default: false)
24
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
11
+ # @option arguments [List] :fields A comma-separated list of fields to return the fielddata size
12
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
13
+ # @option arguments [String] :bytes The unit in which to display byte values
14
+ # (options: b,k,kb,m,mb,g,gb,t,tb,p,pb)
15
+
25
16
  # @option arguments [List] :h Comma-separated list of column names to display
26
17
  # @option arguments [Boolean] :help Return help information
27
- # @option arguments [Boolean] :v Verbose mode. Display column headers
28
18
  # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
19
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
20
+ # @option arguments [List] :fields A comma-separated list of fields to return in the output
21
+
29
22
  #
30
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html
23
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat-fielddata.html
31
24
  #
32
- def fielddata(arguments={})
33
- fields = arguments.delete(:fields)
25
+ def fielddata(arguments = {})
26
+ arguments = arguments.clone
34
27
 
35
- method = HTTP_GET
36
- path = Utils.__pathify "_cat/fielddata", Utils.__listify(fields)
28
+ _fields = arguments.delete(:fields)
29
+
30
+ method = Elasticsearch::API::HTTP_GET
31
+ path = if _fields
32
+ "_cat/fielddata/#{Utils.__listify(_fields)}"
33
+ else
34
+ "_cat/fielddata"
35
+ end
37
36
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
38
- body = nil
39
37
 
38
+ body = nil
40
39
  perform_request(method, path, params, body).body
41
40
  end
42
41
 
43
42
  # Register this action with its valid params when the module is loaded.
44
43
  #
45
- # @since 6.1.1
44
+ # @since 6.2.0
46
45
  ParamsRegistry.register(:fielddata, [
47
- :format,
48
- :bytes,
49
- :local,
50
- :master_timeout,
51
- :h,
52
- :help,
53
- :s,
54
- :v,
55
- :fields ].freeze)
46
+ :format,
47
+ :bytes,
48
+ :h,
49
+ :help,
50
+ :s,
51
+ :v,
52
+ :fields
53
+ ].freeze)
54
+ end
56
55
  end
57
- end
58
56
  end
59
57
  end
@@ -6,56 +6,46 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Display a terse version of the {Elasticsearch::API::Cluster::Actions#health} API output
11
- #
12
- # @example Display cluster health
13
- #
14
- # puts client.cat.health
15
- #
16
- # @example Display header names in the output
17
- #
18
- # puts client.cat.health v: true
19
- #
20
- # @example Return the information as Ruby objects
9
+ # Returns a concise representation of the cluster health.
21
10
  #
22
- # client.cat.health format: 'json'
23
- #
24
- # @option arguments [Boolean] :ts Whether to display timestamp 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
11
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
12
+ # @option arguments [List] :h Comma-separated list of column names to display
13
+ # @option arguments [Boolean] :help Return help information
27
14
  # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
28
- # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
29
- # @option arguments [Boolean] :help Return information about headers
30
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
31
- # (default: false)
32
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
15
+ # @option arguments [String] :time The unit in which to display time values
16
+ # (options: d (Days),h (Hours),m (Minutes),s (Seconds),ms (Milliseconds),micros (Microseconds),nanos (Nanoseconds))
17
+
18
+ # @option arguments [Boolean] :ts Set to false to disable timestamping
19
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
20
+
33
21
  #
34
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html
22
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat-health.html
35
23
  #
36
- def health(arguments={})
37
- method = HTTP_GET
24
+ def health(arguments = {})
25
+ arguments = arguments.clone
26
+
27
+ method = Elasticsearch::API::HTTP_GET
38
28
  path = "_cat/health"
39
- params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
29
+ params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
40
30
  params[:h] = Utils.__listify(params[:h]) if params[:h]
41
- body = nil
42
31
 
32
+ body = nil
43
33
  perform_request(method, path, params, body).body
44
34
  end
45
35
 
46
36
  # Register this action with its valid params when the module is loaded.
47
37
  #
48
- # @since 6.1.1
38
+ # @since 6.2.0
49
39
  ParamsRegistry.register(:health, [
50
- :format,
51
- :local,
52
- :master_timeout,
53
- :h,
54
- :help,
55
- :s,
56
- :ts,
57
- :v ].freeze)
40
+ :format,
41
+ :h,
42
+ :help,
43
+ :s,
44
+ :time,
45
+ :ts,
46
+ :v
47
+ ].freeze)
48
+ end
58
49
  end
59
- end
60
50
  end
61
51
  end
@@ -6,29 +6,33 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Help information for the Cat API
9
+ # Returns help for the Cat APIs.
11
10
  #
12
11
  # @option arguments [Boolean] :help Return help information
12
+ # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
13
+
13
14
  #
14
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html
15
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat.html
15
16
  #
16
- def help(arguments={})
17
- method = HTTP_GET
17
+ def help(arguments = {})
18
+ arguments = arguments.clone
19
+
20
+ method = Elasticsearch::API::HTTP_GET
18
21
  path = "_cat"
19
22
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
20
- body = nil
21
23
 
24
+ body = nil
22
25
  perform_request(method, path, params, body).body
23
26
  end
24
27
 
25
28
  # Register this action with its valid params when the module is loaded.
26
29
  #
27
- # @since 6.1.1
30
+ # @since 6.2.0
28
31
  ParamsRegistry.register(:help, [
29
- :help,
30
- :s ].freeze)
32
+ :help,
33
+ :s
34
+ ].freeze)
35
+ end
31
36
  end
32
- end
33
37
  end
34
38
  end
@@ -6,84 +6,67 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Return the most important statistics about indices, across the cluster nodes
11
- #
12
- # Use the `help` parameter to display available statistics.
13
- #
14
- # @example Display information for all indices
15
- #
16
- # puts client.cat.indices
17
- #
18
- # @example Display information for a specific index
19
- #
20
- # puts client.cat.indices index: 'index-a'
21
- #
22
- # @example Display information for indices matching a pattern
23
- #
24
- # puts client.cat.indices index: 'index-*'
25
- #
26
- # @example Display header names in the output
27
- #
28
- # puts client.cat.indices v: true
29
- #
30
- # @example Display only specific columns in the output (see the `help` parameter)
31
- #
32
- # puts client.cat.indices h: ['index', 'docs.count', 'fielddata.memory_size', 'filter_cache.memory_size']
33
- #
34
- # @example Display only specific columns in the output, using the short names
35
- #
36
- # puts client.cat.indices h: 'i,dc,ss,mt', v: true
37
- #
38
- # @example Return the information as Ruby objects
39
- #
40
- # client.cat.indices format: 'json'
9
+ # Returns information about indices: number of primaries and replicas, document counts, disk size, ...
41
10
  #
42
11
  # @option arguments [List] :index A comma-separated list of index names to limit the returned information
43
- # @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
44
- # @option arguments [Boolean] :pri Limit the returned information on primary shards only (default: false)
45
- # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
46
- # @option arguments [Boolean] :v Display column headers as part of the output
47
- # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
48
- # @option arguments [String] :health A health status ("green", "yellow", or "red" to filter only indices
49
- # matching the specified health status (options: green, yellow, red)
50
- # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
51
- # @option arguments [Boolean] :help Return information about headers
52
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
53
- # (default: false)
12
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
13
+ # @option arguments [String] :bytes The unit in which to display byte values
14
+ # (options: b,k,m,g)
15
+
16
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
54
17
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
18
+ # @option arguments [List] :h Comma-separated list of column names to display
19
+ # @option arguments [String] :health A health status ("green", "yellow", or "red" to filter only indices matching the specified health status
20
+ # (options: green,yellow,red)
21
+
22
+ # @option arguments [Boolean] :help Return help information
23
+ # @option arguments [Boolean] :pri Set to true to return stats only for primary shards
24
+ # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
25
+ # @option arguments [String] :time The unit in which to display time values
26
+ # (options: d (Days),h (Hours),m (Minutes),s (Seconds),ms (Milliseconds),micros (Microseconds),nanos (Nanoseconds))
27
+
28
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
29
+ # @option arguments [Boolean] :include_unloaded_segments If set to true segment stats will include stats for segments that are not currently loaded into memory
30
+
55
31
  #
56
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html
32
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat-indices.html
57
33
  #
58
- def indices(arguments={})
59
- index = arguments.delete(:index)
60
- method = HTTP_GET
34
+ def indices(arguments = {})
35
+ arguments = arguments.clone
61
36
 
62
- path = Utils.__pathify '_cat/indices', Utils.__listify(index)
37
+ _index = arguments.delete(:index)
63
38
 
39
+ method = Elasticsearch::API::HTTP_GET
40
+ path = if _index
41
+ "_cat/indices/#{Utils.__listify(_index)}"
42
+ else
43
+ "_cat/indices"
44
+ end
64
45
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
65
46
  params[:h] = Utils.__listify(params[:h]) if params[:h]
66
47
 
67
- body = nil
68
-
48
+ body = nil
69
49
  perform_request(method, path, params, body).body
70
50
  end
71
51
 
72
52
  # Register this action with its valid params when the module is loaded.
73
53
  #
74
- # @since 6.1.1
54
+ # @since 6.2.0
75
55
  ParamsRegistry.register(:indices, [
76
- :format,
77
- :bytes,
78
- :local,
79
- :master_timeout,
80
- :h,
81
- :health,
82
- :help,
83
- :pri,
84
- :s,
85
- :v ].freeze)
56
+ :format,
57
+ :bytes,
58
+ :local,
59
+ :master_timeout,
60
+ :h,
61
+ :health,
62
+ :help,
63
+ :pri,
64
+ :s,
65
+ :time,
66
+ :v,
67
+ :include_unloaded_segments
68
+ ].freeze)
69
+ end
86
70
  end
87
- end
88
71
  end
89
72
  end
@@ -6,53 +6,43 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Display basic information about the master node
11
- #
12
- # @example
13
- #
14
- # puts client.cat.master
15
- #
16
- # @example Display header names in the output
17
- #
18
- # puts client.cat.master v: true
19
- #
20
- # @example Return the information as Ruby objects
9
+ # Returns information about the master node.
21
10
  #
22
- # client.cat.master format: 'json'
23
- #
24
- # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
25
- # @option arguments [Boolean] :v Display column headers as part of the output
26
- # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
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)
11
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
12
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
31
13
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
14
+ # @option arguments [List] :h Comma-separated list of column names to display
15
+ # @option arguments [Boolean] :help Return help information
16
+ # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
17
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
18
+
32
19
  #
33
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html
20
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat-master.html
34
21
  #
35
- def master(arguments={})
36
- method = HTTP_GET
22
+ def master(arguments = {})
23
+ arguments = arguments.clone
24
+
25
+ method = Elasticsearch::API::HTTP_GET
37
26
  path = "_cat/master"
38
27
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
39
- body = nil
40
28
 
29
+ body = nil
41
30
  perform_request(method, path, params, body).body
42
31
  end
43
32
 
44
33
  # Register this action with its valid params when the module is loaded.
45
34
  #
46
- # @since 6.1.1
35
+ # @since 6.2.0
47
36
  ParamsRegistry.register(:master, [
48
- :format,
49
- :local,
50
- :master_timeout,
51
- :h,
52
- :help,
53
- :s,
54
- :v ].freeze)
37
+ :format,
38
+ :local,
39
+ :master_timeout,
40
+ :h,
41
+ :help,
42
+ :s,
43
+ :v
44
+ ].freeze)
45
+ end
55
46
  end
56
- end
57
47
  end
58
48
  end