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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecee794892845a6e8aabd3e013758290f63ebf2b140720e13975c21108480026
4
- data.tar.gz: 11632fbccfa4f40915794e03cc9905333c627b2240bcd890f1f21f20e4c87e59
3
+ metadata.gz: 74b73b73058b57c24e14290363a4a34dbc56b6659920097f0c18a0cf6bdf2203
4
+ data.tar.gz: eb57d7f723a4664d25a975b64a8effdbb06eaad5f887958db0637e40e7a39dae
5
5
  SHA512:
6
- metadata.gz: 5ca7fd376ebee945913fe516b9672a0ef2ddf436e55b2503c76611a510d70686e741df67e5e4a38df4ec50bb57e4be47909fdc1f3c8b79c621df6449d7e03db2
7
- data.tar.gz: 58198c72df28aca80aed6f59ec4e8e3f034ebd13b3368b50075e73d3c8f484e8f51b604df7b79b7210095fd97f0b032d7252dcac501520dd8d2734274c7fc026
6
+ metadata.gz: '08c0134941091ef48f11569e457fbb304020830bbfdfaac52de7116354e44f03146b4bb05795c50fed957a3f0362ddbdcf32213b7816ea25bbf2f66c06f2046b'
7
+ data.tar.gz: b0291a448d2335ca9d29252d5bb355118385a136b8fb3d7c61fb15cb2e64d8d3d0307770c5239a264bb5fa9a78fb7c52a20b5b0fb70a41f6b3ce9da839d73cee
data/Rakefile CHANGED
@@ -2,7 +2,7 @@
2
2
  # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
3
  # See the LICENSE file in the project root for more information
4
4
 
5
- require "bundler/gem_tasks"
5
+ require 'bundler/gem_tasks'
6
6
 
7
7
  def __current__
8
8
  Pathname( File.expand_path('..', __FILE__) )
@@ -12,8 +12,8 @@ def git_specs(command, options={})
12
12
  sh "git --git-dir=#{__current__.join('../tmp/elasticsearch/.git')} --work-tree=#{__current__.join('../tmp/elasticsearch')} #{command}", options
13
13
  end
14
14
 
15
- task(:default) { system "rake --tasks" }
16
- task :test => 'test:unit'
15
+ task(:default) { system 'rake --tasks' }
16
+ task test: 'test:unit'
17
17
 
18
18
  # ----- Test tasks ------------------------------------------------------------
19
19
 
@@ -21,35 +21,30 @@ require 'rake/testtask'
21
21
  require 'rspec/core/rake_task'
22
22
 
23
23
  namespace :test do
24
-
25
- desc "Wait for Elasticsearch to be in a green state"
24
+ desc 'Wait for Elasticsearch to be in a green state'
26
25
  task :wait_for_green do
27
26
  sh '../scripts/wait-cluster.sh'
28
27
  end
29
28
 
29
+ # Unit tests - rake test:unit
30
+ #
31
+ task unit: :spec
30
32
  RSpec::Core::RakeTask.new(:spec) do |t|
31
33
  t.exclude_pattern = 'spec/**{,/*/**}/rest_api_yaml_spec.rb'
32
34
  end
33
35
 
36
+ # Rest API Spec tests - rake test:rest_api
34
37
  RSpec::Core::RakeTask.new(:rest_api) do |t|
35
38
  t.pattern = 'spec/**{,/*/**}/rest_api_yaml_spec.rb'
36
39
  end
37
40
 
38
- desc "Update the repository with YAML tests"
41
+ desc 'Update the repository with YAML tests'
39
42
  task :update do
40
- git_specs "fetch origin", :verbose => true
41
- end
42
-
43
- Rake::TestTask.new(:unit) do |test|
44
- test.libs << 'lib' << 'test'
45
- test.test_files = FileList["test/unit/**/*_test.rb"]
46
- test.deps = [ :spec ]
47
- # test.verbose = true
48
- # test.warning = true
43
+ git_specs 'fetch origin', verbose: true
49
44
  end
50
45
 
51
46
  desc "Run integration tests"
52
- task :integration => :update do
47
+ task integration: :update do
53
48
  require 'elasticsearch'
54
49
 
55
50
  branches = `git --git-dir=#{__current__.join('../tmp/elasticsearch/.git')} --work-tree=#{__current__.join('../tmp/elasticsearch')} branch --no-color`
@@ -107,7 +102,7 @@ namespace :test do
107
102
  end
108
103
  end
109
104
 
110
- desc "Run unit and integration tests"
105
+ desc 'Run unit and integration tests'
111
106
  task :all do
112
107
  Rake::Task['test:unit'].invoke
113
108
  Rake::Task['test:integration'].invoke
@@ -139,10 +134,8 @@ end
139
134
 
140
135
  # ----- Code analysis tasks ---------------------------------------------------
141
136
 
142
- if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
143
- require 'cane/rake_task'
144
- Cane::RakeTask.new(:quality) do |cane|
145
- cane.abc_max = 15
146
- cane.no_style = true
147
- end
137
+ require 'cane/rake_task'
138
+ Cane::RakeTask.new(:quality) do |cane|
139
+ cane.abc_max = 15
140
+ cane.no_style = true
148
141
  end
@@ -5,7 +5,6 @@
5
5
  module Elasticsearch
6
6
  module API
7
7
  module Actions
8
-
9
8
  # Abort a running benchmark
10
9
  #
11
10
  # @example
@@ -16,7 +15,7 @@ module Elasticsearch
16
15
  #
17
16
  # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-benchmark.html
18
17
  #
19
- def abort_benchmark(arguments={})
18
+ def abort_benchmark(arguments = {})
20
19
  method = HTTP_POST
21
20
  path = "_bench/abort/#{arguments[:name]}"
22
21
  params = {}
@@ -5,7 +5,6 @@
5
5
  module Elasticsearch
6
6
  module API
7
7
  module Actions
8
-
9
8
  # Run a single query, or a set of queries, and return statistics on their performance
10
9
  #
11
10
  # @example Return statistics for a single query
@@ -51,7 +50,7 @@ module Elasticsearch
51
50
  #
52
51
  # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-benchmark.html
53
52
  #
54
- def benchmark(arguments={})
53
+ def benchmark(arguments = {})
55
54
  method = HTTP_PUT
56
55
  path = "_bench"
57
56
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
@@ -63,7 +62,7 @@ module Elasticsearch
63
62
  # Register this action with its valid params when the module is loaded.
64
63
  #
65
64
  # @since 6.1.1
66
- ParamsRegistry.register(:benchmark, [ :verbose ].freeze)
65
+ ParamsRegistry.register(:benchmark, [:verbose].freeze)
67
66
  end
68
67
  end
69
68
  end
@@ -5,57 +5,14 @@
5
5
  module Elasticsearch
6
6
  module API
7
7
  module Actions
8
-
9
- # Perform multiple index, delete or update operations in a single request.
10
- #
11
- # Supports various different formats of the payload: Array of Strings, Header/Data pairs,
12
- # or the conveniency "combined" format where data is passed along with the header
13
- # in a single item in a custom `:data` key.
14
- #
15
- # @note The body argument is required and cannot be empty.
16
- #
17
- # @example Perform three operations in a single request, passing actions and data as an array of hashes
18
- #
19
- # client.bulk body: [
20
- # { index: { _index: 'myindex', _type: 'mytype', _id: 1 } },
21
- # { title: 'foo' },
22
- #
23
- # { index: { _index: 'myindex', _type: 'mytype', _id: 2 } },
24
- # { title: 'foo' },
25
- #
26
- # { delete: { _index: 'myindex', _type: 'mytype', _id: 3 } }
27
- # ]
28
- # @example Perform three operations in a single request, passing data in the `:data` option
29
- #
30
- # client.bulk body: [
31
- # { index: { _index: 'myindex', _type: 'mytype', _id: 1, data: { title: 'foo' } } },
32
- # { update: { _index: 'myindex', _type: 'mytype', _id: 2, data: { doc: { title: 'foo' } } } },
33
- # { delete: { _index: 'myindex', _type: 'mytype', _id: 3 } }
34
- # ]
35
- #
36
- # @example Perform a script-based bulk update, passing scripts in the `:data` option
37
- #
38
- # client.bulk body: [
39
- # { update: { _index: 'myindex', _type: 'mytype', _id: 1,
40
- # data: {
41
- # script: "ctx._source.counter += value",
42
- # lang: 'js',
43
- # params: { value: 1 }, upsert: { counter: 0 } }
44
- # }},
45
- # { update: { _index: 'myindex', _type: 'mytype', _id: 2,
46
- # data: {
47
- # script: "ctx._source.counter += value",
48
- # lang: 'js',
49
- # params: { value: 42 }, upsert: { counter: 0 } }
50
- # }}
51
- #
52
- # ]
8
+ # Allows to perform multiple index/update/delete operations in a single request.
53
9
  #
54
10
  # @option arguments [String] :index Default index for items which don't provide one
55
11
  # @option arguments [String] :type Default document type for items which don't provide one
56
- # @option arguments [Hash] :body The operation definition and data (action-data pairs), separated by newlines (*Required*)
57
12
  # @option arguments [String] :wait_for_active_shards Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
58
- # @option arguments [String] :refresh If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. (options: true, false, wait_for)
13
+ # @option arguments [String] :refresh If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
14
+ # (options: true,false,wait_for)
15
+
59
16
  # @option arguments [String] :routing Specific routing value
60
17
  # @option arguments [Time] :timeout Explicit operation timeout
61
18
  # @option arguments [String] :type Default document type for items which don't provide one
@@ -63,44 +20,54 @@ module Elasticsearch
63
20
  # @option arguments [List] :_source_excludes Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
64
21
  # @option arguments [List] :_source_includes Default list of fields to extract and return from the _source field, can be overridden on each sub-request
65
22
  # @option arguments [String] :pipeline The pipeline id to preprocess incoming documents with
23
+
24
+ # @option arguments [Hash] :body The operation definition and data (action-data pairs), separated by newlines (*Required*)
66
25
  #
67
- # @return [Hash] Deserialized Elasticsearch response
68
- #
69
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
26
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-bulk.html
70
27
  #
71
- def bulk(arguments={})
28
+ def bulk(arguments = {})
29
+ raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
30
+
72
31
  arguments = arguments.clone
73
32
 
74
- type = arguments.delete(:type)
33
+ _index = arguments.delete(:index)
75
34
 
76
- method = HTTP_POST
77
- path = Utils.__pathify Utils.__escape(arguments[:index]), Utils.__escape(type), '_bulk'
35
+ _type = arguments.delete(:type)
78
36
 
37
+ method = Elasticsearch::API::HTTP_POST
38
+ path = if _index && _type
39
+ "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_bulk"
40
+ elsif _index
41
+ "#{Utils.__listify(_index)}/_bulk"
42
+ else
43
+ "_bulk"
44
+ end
79
45
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
80
- body = arguments[:body]
81
46
 
47
+ body = arguments[:body]
82
48
  if body.is_a? Array
83
49
  payload = Utils.__bulkify(body)
84
50
  else
85
51
  payload = body
86
- end
52
+ end
87
53
 
88
- perform_request(method, path, params, payload, {"Content-Type" => "application/x-ndjson"}).body
54
+ perform_request(method, path, params, payload, { "Content-Type" => "application/x-ndjson" }).body
89
55
  end
90
56
 
91
57
  # Register this action with its valid params when the module is loaded.
92
58
  #
93
- # @since 6.1.1
59
+ # @since 6.2.0
94
60
  ParamsRegistry.register(:bulk, [
95
- :wait_for_active_shards,
96
- :refresh,
97
- :routing,
98
- :timeout,
99
- :type,
100
- :_source,
101
- :_source_excludes,
102
- :_source_includes,
103
- :pipeline ].freeze)
61
+ :wait_for_active_shards,
62
+ :refresh,
63
+ :routing,
64
+ :timeout,
65
+ :type,
66
+ :_source,
67
+ :_source_excludes,
68
+ :_source_includes,
69
+ :pipeline
70
+ ].freeze)
71
+ end
104
72
  end
105
- end
106
73
  end
@@ -6,71 +6,49 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Returns information about aliases, including associated routing values and filters.
11
- #
12
- # @example Display all aliases in the cluster
13
- #
14
- # puts client.cat.aliases
15
- #
16
- # @example Display indices for the 'year-2013' alias
17
- #
18
- # puts client.cat.aliases name: 'year-2013'
19
- #
20
- # @example Display header names in the output
21
- #
22
- # puts client.cat.aliases v: true
23
- #
24
- # @example Return only the 'alias' and 'index' columns
25
- #
26
- # puts client.cat.aliases h: ['alias', 'index']
27
- #
28
- # @example Return only the 'alias' and 'index' columns, using short names
29
- #
30
- # puts client.cat.aliases h: 'a,i'
31
- #
32
- # @example Return the output sorted by the alias name
33
- #
34
- # puts client.cat.aliases s: 'alias'
35
- #
36
- # @example Return the information as Ruby objects
37
- #
38
- # client.cat.aliases format: 'json'
9
+ # Shows information about currently configured aliases to indices including filter and routing infos.
39
10
  #
40
11
  # @option arguments [List] :name A comma-separated list of alias names to return
41
- # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
42
- # @option arguments [Boolean] :v Display column headers as part of the output
12
+ # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
13
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
14
+ # @option arguments [List] :h Comma-separated list of column names to display
15
+ # @option arguments [Boolean] :help Return help information
43
16
  # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
44
- # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
45
- # @option arguments [Boolean] :help Return information about headers
46
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
47
- # (default: false)
48
- # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
17
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
18
+
49
19
  #
50
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-aliases.html
20
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat-alias.html
51
21
  #
52
- def aliases(arguments={})
53
- name = arguments.delete(:name)
54
- method = HTTP_GET
55
- path = Utils.__pathify '_cat/aliases', Utils.__listify(name)
22
+ def aliases(arguments = {})
23
+ arguments = arguments.clone
24
+
25
+ _name = arguments.delete(:name)
26
+
27
+ method = Elasticsearch::API::HTTP_GET
28
+ path = if _name
29
+ "_cat/aliases/#{Utils.__listify(_name)}"
30
+ else
31
+ "_cat/aliases"
32
+ end
56
33
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
57
34
  params[:h] = Utils.__listify(params[:h]) if params[:h]
58
- body = nil
35
+
36
+ body = nil
59
37
  perform_request(method, path, params, body).body
60
38
  end
61
39
 
62
40
  # Register this action with its valid params when the module is loaded.
63
41
  #
64
- # @since 6.1.1
42
+ # @since 6.2.0
65
43
  ParamsRegistry.register(:aliases, [
66
- :format,
67
- :local,
68
- :master_timeout,
69
- :h,
70
- :help,
71
- :s,
72
- :v ].freeze)
44
+ :format,
45
+ :local,
46
+ :h,
47
+ :help,
48
+ :s,
49
+ :v
50
+ ].freeze)
51
+ end
73
52
  end
74
- end
75
53
  end
76
54
  end
@@ -6,69 +6,55 @@ module Elasticsearch
6
6
  module API
7
7
  module Cat
8
8
  module Actions
9
-
10
- # Return shard allocation information
11
- #
12
- # @example Display allocation for all nodes in the cluster
13
- #
14
- # puts client.cat.allocation
15
- #
16
- # @example Display allocation for node with name 'node-1'
17
- #
18
- # puts client.cat.allocation node_id: 'node-1'
19
- #
20
- # @example Display header names in the output
21
- #
22
- # puts client.cat.allocation v: true
23
- #
24
- # @example Display only specific columns in the output (see the `help` parameter)
25
- #
26
- # puts client.cat.allocation h: ['node', 'shards', 'disk.percent']
27
- #
28
- # @example Display only specific columns in the output, using the short names
29
- #
30
- # puts client.cat.allocation h: 'n,s,dp'
31
- #
32
- # @example Return the information as Ruby objects
33
- #
34
- # client.cat.allocation format: 'json'
9
+ # Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using.
35
10
  #
36
11
  # @option arguments [List] :node_id A comma-separated list of node IDs or names to limit the returned information
37
- # @option arguments [String] :bytes The unit in which to display byte values (options: b, k, m, g)
38
- # @option arguments [List] :h Comma-separated list of column names to display -- see the `help` argument
39
- # @option arguments [Boolean] :v Display column headers as part of the output
40
- # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
41
- # @option arguments [String] :format The output format. Options: 'text', 'json'; default: 'text'
42
- # @option arguments [Boolean] :help Return information about headers
43
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
44
- # (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,kb,m,mb,g,gb,t,tb,p,pb)
15
+
16
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
45
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 [Boolean] :help Return help information
20
+ # @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
21
+ # @option arguments [Boolean] :v Verbose mode. Display column headers
22
+
46
23
  #
47
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html
24
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/cat-allocation.html
48
25
  #
49
- def allocation(arguments={})
50
- node_id = arguments.delete(:node_id)
51
- method = HTTP_GET
52
- path = Utils.__pathify '_cat/allocation', Utils.__listify(node_id)
26
+ def allocation(arguments = {})
27
+ arguments = arguments.clone
28
+
29
+ _node_id = arguments.delete(:node_id)
30
+
31
+ method = Elasticsearch::API::HTTP_GET
32
+ path = if _node_id
33
+ "_cat/allocation/#{Utils.__listify(_node_id)}"
34
+ else
35
+ "_cat/allocation"
36
+ end
53
37
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
54
38
  params[:h] = Utils.__listify(params[:h]) if params[:h]
55
- body = nil
39
+
40
+ body = nil
56
41
  perform_request(method, path, params, body).body
57
42
  end
58
43
 
59
44
  # Register this action with its valid params when the module is loaded.
60
45
  #
61
- # @since 6.1.1
46
+ # @since 6.2.0
62
47
  ParamsRegistry.register(:allocation, [
63
- :format,
64
- :bytes,
65
- :local,
66
- :master_timeout,
67
- :h,
68
- :help,
69
- :s,
70
- :v ].freeze)
48
+ :format,
49
+ :bytes,
50
+ :local,
51
+ :master_timeout,
52
+ :h,
53
+ :help,
54
+ :s,
55
+ :v
56
+ ].freeze)
57
+ end
71
58
  end
72
- end
73
59
  end
74
60
  end