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,39 +6,44 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Return true if the specified index template exists, false otherwise.
11
- #
12
- # client.indices.exists_template? name: 'mytemplate'
9
+ # Returns information about whether a particular index template exists.
13
10
  #
14
- # @option arguments [String] :name The name of the template (*Required*)
15
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
11
+ # @option arguments [List] :name The comma separated names of the index templates
12
+ # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
16
13
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
14
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
15
+
17
16
  #
18
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
17
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-templates.html
19
18
  #
20
- def exists_template(arguments={})
19
+ def exists_template(arguments = {})
21
20
  raise ArgumentError, "Required argument 'name' missing" unless arguments[:name]
22
- method = HTTP_HEAD
23
- path = Utils.__pathify '_template', Utils.__escape(arguments[:name])
24
21
 
22
+ arguments = arguments.clone
23
+
24
+ _name = arguments.delete(:name)
25
+
26
+ method = Elasticsearch::API::HTTP_HEAD
27
+ path = "_template/#{Utils.__listify(_name)}"
25
28
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
29
+
26
30
  body = nil
27
31
 
28
32
  Utils.__rescue_from_not_found do
29
33
  perform_request(method, path, params, body).status == 200 ? true : false
30
34
  end
31
35
  end
32
- alias_method :exists_template?, :exists_template
33
36
 
37
+ alias_method :exists_template?, :exists_template
34
38
  # Register this action with its valid params when the module is loaded.
35
39
  #
36
- # @since 6.1.1
40
+ # @since 6.2.0
37
41
  ParamsRegistry.register(:exists_template, [
38
- :flat_settings,
39
- :master_timeout,
40
- :local ].freeze)
42
+ :flat_settings,
43
+ :master_timeout,
44
+ :local
45
+ ].freeze)
46
+ end
41
47
  end
42
- end
43
48
  end
44
49
  end
@@ -6,52 +6,52 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Return true if the specified type exists, false otherwise.
11
- #
12
- # client.indices.exists_type? index: 'myindex', type: 'mytype'
9
+ # Returns information about whether a particular document type exists. (DEPRECATED)
13
10
  #
14
- # @option arguments [List] :index A comma-separated list of index names; use `_all`
15
- # to check the types across all indices (*Required*)
16
- # @option arguments [List] :type A comma-separated list of document types to check (*Required*)
17
- # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
18
- # no concrete indices. (This includes `_all` string or when no
19
- # indices have been specified)
20
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
21
- # are open, closed or both. (options: open, closed)
22
- # @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
23
- # `missing` ones (options: none, missing) @until 1.0
24
- # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
25
- # unavailable (missing, closed, etc)
26
- # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node
27
- # (default: false)
11
+ # @option arguments [List] :index A comma-separated list of index names; use `_all` to check the types across all indices
12
+ # @option arguments [List] :type A comma-separated list of document types to check
13
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
14
+ # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
15
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
16
+ # (options: open,closed,none,all)
17
+
18
+ # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
19
+
28
20
  #
29
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html
21
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-types-exists.html
30
22
  #
31
- def exists_type(arguments={})
23
+ def exists_type(arguments = {})
32
24
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
33
25
  raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
34
- method = HTTP_HEAD
35
- path = Utils.__pathify Utils.__listify(arguments[:index]), '_mapping', Utils.__escape(arguments[:type])
36
26
 
27
+ arguments = arguments.clone
28
+
29
+ _index = arguments.delete(:index)
30
+
31
+ _type = arguments.delete(:type)
32
+
33
+ method = Elasticsearch::API::HTTP_HEAD
34
+ path = "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}"
37
35
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
36
+
38
37
  body = nil
39
38
 
40
39
  Utils.__rescue_from_not_found do
41
40
  perform_request(method, path, params, body).status == 200 ? true : false
42
41
  end
43
42
  end
44
- alias_method :exists_type?, :exists_type
45
43
 
44
+ alias_method :exists_type?, :exists_type
46
45
  # Register this action with its valid params when the module is loaded.
47
46
  #
48
- # @since 6.1.1
47
+ # @since 6.2.0
49
48
  ParamsRegistry.register(:exists_type, [
50
- :ignore_unavailable,
51
- :allow_no_indices,
52
- :expand_wildcards,
53
- :local ].freeze)
49
+ :ignore_unavailable,
50
+ :allow_no_indices,
51
+ :expand_wildcards,
52
+ :local
53
+ ].freeze)
54
+ end
54
55
  end
55
- end
56
56
  end
57
57
  end
@@ -6,47 +6,47 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # "Flush" the index or indices.
11
- #
12
- # The "flush" operation clears the transaction log and memory and writes data to disk.
13
- # It corresponds to a Lucene "commit" operation.
14
- #
15
- # @note The flush operation is handled automatically by Elasticsearch, you don't need to perform it manually.
9
+ # Performs the flush operation on one or more indices.
16
10
  #
17
11
  # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices
18
- # @option arguments [Boolean] :force Whether a flush should be forced even if it is not necessarily needed ie.
19
- # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
20
- # no concrete indices. (This includes `_all` string or when no
21
- # indices have been specified)
22
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
23
- # are open, closed or both. (options: open, closed)
24
- # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
25
- # unavailable (missing, closed, etc)
26
- # @option arguments [Boolean] :wait_if_ongoing If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. If set to false the flush will be skipped if another flush operation is already running. (Default: true)
12
+ # @option arguments [Boolean] :force Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal)
13
+ # @option arguments [Boolean] :wait_if_ongoing If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running.
14
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
15
+ # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
16
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
17
+ # (options: open,closed,none,all)
18
+
27
19
  #
28
- # @see https://www.elastic.co/guide/reference/api/admin-indices-flush/
20
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-flush.html
29
21
  #
30
- def flush(arguments={})
31
- method = HTTP_POST
32
- path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush'
22
+ def flush(arguments = {})
23
+ arguments = arguments.clone
24
+
25
+ _index = arguments.delete(:index)
33
26
 
27
+ method = Elasticsearch::API::HTTP_POST
28
+ path = if _index
29
+ "#{Utils.__listify(_index)}/_flush"
30
+ else
31
+ "_flush"
32
+ end
34
33
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
35
- body = nil
36
34
 
35
+ body = nil
37
36
  perform_request(method, path, params, body).body
38
37
  end
39
38
 
40
39
  # Register this action with its valid params when the module is loaded.
41
40
  #
42
- # @since 6.1.1
41
+ # @since 6.2.0
43
42
  ParamsRegistry.register(:flush, [
44
- :force,
45
- :wait_if_ongoing,
46
- :ignore_unavailable,
47
- :allow_no_indices,
48
- :expand_wildcards ].freeze)
43
+ :force,
44
+ :wait_if_ongoing,
45
+ :ignore_unavailable,
46
+ :allow_no_indices,
47
+ :expand_wildcards
48
+ ].freeze)
49
+ end
49
50
  end
50
- end
51
51
  end
52
52
  end
@@ -6,21 +6,31 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
9
+ # Performs a synced flush operation on one or more indices.
10
+ #
10
11
  # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string for all indices
11
12
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
12
13
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
13
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
14
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
15
+ # (options: open,closed,none,all)
16
+
14
17
  #
15
- # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-synced-flush-api.html
16
19
  #
17
- def flush_synced(arguments={})
18
- method = HTTP_POST
19
- path = Utils.__pathify Utils.__listify(arguments[:index]), '_flush/synced'
20
+ def flush_synced(arguments = {})
21
+ arguments = arguments.clone
20
22
 
23
+ _index = arguments.delete(:index)
24
+
25
+ method = Elasticsearch::API::HTTP_POST
26
+ path = if _index
27
+ "#{Utils.__listify(_index)}/_flush/synced"
28
+ else
29
+ "_flush/synced"
30
+ end
21
31
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
22
- body = nil
23
32
 
33
+ body = nil
24
34
  if Array(arguments[:ignore]).include?(404)
25
35
  Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
26
36
  else
@@ -30,12 +40,13 @@ module Elasticsearch
30
40
 
31
41
  # Register this action with its valid params when the module is loaded.
32
42
  #
33
- # @since 6.1.1
43
+ # @since 6.2.0
34
44
  ParamsRegistry.register(:flush_synced, [
35
- :ignore_unavailable,
36
- :allow_no_indices,
37
- :expand_wildcards ].freeze)
45
+ :ignore_unavailable,
46
+ :allow_no_indices,
47
+ :expand_wildcards
48
+ ].freeze)
49
+ end
38
50
  end
39
- end
40
51
  end
41
52
  end
@@ -6,65 +6,50 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Force merge an index, list of indices, or all indices in the cluster.
11
- #
12
- # @example Fully force merge an index
13
- #
14
- # client.indices.forcemerge index: 'foo', max_num_segments: 1
15
- #
16
- # @example Do not flush index after force-merging
17
- #
18
- # client.indices.forcemerge index: 'foo', flush: false
19
- #
20
- # @example Do not expunge deleted documents after force-merging
21
- #
22
- # client.indices.forcemerge index: 'foo', only_expunge_deletes: false
23
- #
24
- # @example Force merge a list of indices
25
- #
26
- # client.indices.forcemerge index: ['foo', 'bar']
27
- # client.indices.forcemerge index: 'foo,bar'
28
- #
29
- # @example forcemerge a list of indices matching wildcard expression
30
- #
31
- # client.indices.forcemerge index: 'foo*'
32
- #
33
- # @example forcemerge all indices
34
- #
35
- # client.indices.forcemerge index: '_all'
9
+ # Performs the force merge operation on one or more indices.
36
10
  #
37
11
  # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
38
12
  # @option arguments [Boolean] :flush Specify whether the index should be flushed after performing the operation (default: true)
39
13
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
40
14
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
41
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
15
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
16
+ # (options: open,closed,none,all)
17
+
42
18
  # @option arguments [Number] :max_num_segments The number of segments the index should be merged into (default: dynamic)
43
19
  # @option arguments [Boolean] :only_expunge_deletes Specify whether the operation should only expunge deleted documents
20
+
44
21
  #
45
- # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html
22
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-forcemerge.html
46
23
  #
47
- def forcemerge(arguments={})
48
- method = HTTP_POST
49
- path = Utils.__pathify Utils.__listify(arguments[:index]), '_forcemerge'
24
+ def forcemerge(arguments = {})
25
+ arguments = arguments.clone
50
26
 
27
+ _index = arguments.delete(:index)
28
+
29
+ method = Elasticsearch::API::HTTP_POST
30
+ path = if _index
31
+ "#{Utils.__listify(_index)}/_forcemerge"
32
+ else
33
+ "_forcemerge"
34
+ end
51
35
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
52
- body = nil
53
36
 
37
+ body = nil
54
38
  perform_request(method, path, params, body).body
55
39
  end
56
40
 
57
41
  # Register this action with its valid params when the module is loaded.
58
42
  #
59
- # @since 6.1.1
43
+ # @since 6.2.0
60
44
  ParamsRegistry.register(:forcemerge, [
61
- :flush,
62
- :ignore_unavailable,
63
- :allow_no_indices,
64
- :expand_wildcards,
65
- :max_num_segments,
66
- :only_expunge_deletes ].freeze)
45
+ :flush,
46
+ :ignore_unavailable,
47
+ :allow_no_indices,
48
+ :expand_wildcards,
49
+ :max_num_segments,
50
+ :only_expunge_deletes
51
+ ].freeze)
52
+ end
67
53
  end
68
- end
69
54
  end
70
55
  end
@@ -2,7 +2,6 @@ module Elasticsearch
2
2
  module API
3
3
  module Indices
4
4
  module Actions
5
-
6
5
  # In order to keep indices available and queryable for a longer period but at the same time reduce their
7
6
  # hardware requirements they can be transitioned into a frozen state. Once an index is frozen, all of its
8
7
  # transient shard memory (aside from mappings and analyzers) is moved to persistent storage.
@@ -17,12 +16,13 @@ module Elasticsearch
17
16
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
18
17
 
19
18
  valid_params = [
20
- :timeout,
21
- :master_timeout,
22
- :ignore_unavailable,
23
- :allow_no_indices,
24
- :expand_wildcards,
25
- :wait_for_active_shards]
19
+ :timeout,
20
+ :master_timeout,
21
+ :ignore_unavailable,
22
+ :allow_no_indices,
23
+ :expand_wildcards,
24
+ :wait_for_active_shards
25
+ ]
26
26
 
27
27
  arguments = arguments.clone
28
28
  index = arguments.delete(:index)
@@ -37,4 +37,3 @@ module Elasticsearch
37
37
  end
38
38
  end
39
39
  end
40
-
@@ -6,46 +6,52 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Retrieve information about one or more indices
9
+ # Returns information about one or more indices.
11
10
  #
12
- # @option arguments [List] :index A comma-separated list of index names (*Required*)
11
+ # @option arguments [List] :index A comma-separated list of index names
13
12
  # @option arguments [Boolean] :include_type_name Whether to add the type name to the response (default: false)
14
13
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
15
14
  # @option arguments [Boolean] :ignore_unavailable Ignore unavailable indexes (default: false)
16
15
  # @option arguments [Boolean] :allow_no_indices Ignore if a wildcard expression resolves to no concrete indices (default: false)
17
- # @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, none, all)
16
+ # @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open)
17
+ # (options: open,closed,none,all)
18
+
18
19
  # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
19
20
  # @option arguments [Boolean] :include_defaults Whether to return all default setting for each of the indices.
20
21
  # @option arguments [Time] :master_timeout Specify timeout for connection to master
22
+
21
23
  #
22
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html
24
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-get-index.html
23
25
  #
24
- def get(arguments={})
26
+ def get(arguments = {})
25
27
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
26
- method = HTTP_GET
27
28
 
28
- path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments.delete(:feature))
29
+ arguments = arguments.clone
30
+
31
+ _index = arguments.delete(:index)
29
32
 
33
+ method = Elasticsearch::API::HTTP_GET
34
+ path = "#{Utils.__listify(_index)}"
30
35
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
31
- body = nil
32
36
 
37
+ body = nil
33
38
  perform_request(method, path, params, body).body
34
39
  end
35
40
 
36
41
  # Register this action with its valid params when the module is loaded.
37
42
  #
38
- # @since 6.1.1
43
+ # @since 6.2.0
39
44
  ParamsRegistry.register(:get, [
40
- :include_type_name,
41
- :local,
42
- :ignore_unavailable,
43
- :allow_no_indices,
44
- :expand_wildcards,
45
- :flat_settings,
46
- :include_defaults,
47
- :master_timeout ].freeze)
45
+ :include_type_name,
46
+ :local,
47
+ :ignore_unavailable,
48
+ :allow_no_indices,
49
+ :expand_wildcards,
50
+ :flat_settings,
51
+ :include_defaults,
52
+ :master_timeout
53
+ ].freeze)
54
+ end
48
55
  end
49
- end
50
56
  end
51
57
  end