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,45 +6,53 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Get information about a specific alias.
11
- #
12
- # @example Return all indices an alias points to
13
- #
14
- # client.indices.get_alias name: '2013'
15
- #
16
- # @example Return all indices matching a wildcard pattern an alias points to
9
+ # Returns an alias.
17
10
  #
18
- # client.indices.get_alias index: 'log*', name: '2013'
19
- #
20
- # @option arguments [List] :index A comma-separated list of index names to filter aliases
21
11
  # @option arguments [List] :name A comma-separated list of alias names to return
12
+ # @option arguments [List] :index A comma-separated list of index names to filter aliases
22
13
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
23
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)
24
- # @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
+
25
18
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
19
+
26
20
  #
27
- # @see https://www.elastic.co/guide/reference/api/admin-indices-aliases/
21
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-aliases.html
28
22
  #
29
- def get_alias(arguments={})
30
- method = HTTP_GET
31
- path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name])
23
+ def get_alias(arguments = {})
24
+ arguments = arguments.clone
25
+
26
+ _name = arguments.delete(:name)
32
27
 
28
+ _index = arguments.delete(:index)
29
+
30
+ method = Elasticsearch::API::HTTP_GET
31
+ path = if _index && _name
32
+ "#{Utils.__listify(_index)}/_alias/#{Utils.__listify(_name)}"
33
+ elsif _index
34
+ "#{Utils.__listify(_index)}/_alias"
35
+ elsif _name
36
+ "_alias/#{Utils.__listify(_name)}"
37
+ else
38
+ "_alias"
39
+ end
33
40
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
34
- body = nil
35
41
 
42
+ body = nil
36
43
  perform_request(method, path, params, body).body
37
44
  end
38
45
 
39
46
  # Register this action with its valid params when the module is loaded.
40
47
  #
41
- # @since 6.1.1
48
+ # @since 6.2.0
42
49
  ParamsRegistry.register(:get_alias, [
43
- :ignore_unavailable,
44
- :allow_no_indices,
45
- :expand_wildcards,
46
- :local ].freeze)
50
+ :ignore_unavailable,
51
+ :allow_no_indices,
52
+ :expand_wildcards,
53
+ :local
54
+ ].freeze)
55
+ end
47
56
  end
48
- end
49
57
  end
50
58
  end
@@ -6,62 +6,66 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Return the mapping definition for specific field (or fields)
11
- #
12
- # @example Get mapping for a specific field across all indices
13
- #
14
- # client.indices.get_field_mapping field: 'foo'
15
- #
16
- # @example Get mapping for a specific field in an index
17
- #
18
- # client.indices.get_field_mapping index: 'foo', field: 'bar'
19
- #
20
- # @example Get mappings for multiple fields in an index
21
- #
22
- # client.indices.get_field_mapping index: 'foo', field: ['bar', 'bam']
9
+ # Returns mapping for one or more fields.
23
10
  #
11
+ # @option arguments [List] :fields A comma-separated list of fields
24
12
  # @option arguments [List] :index A comma-separated list of index names
25
- # @option arguments [List] :type A comma-separated list of document types
26
- # @option arguments [List] :fields A comma-separated list of fields (*Required*)
13
+ # @option arguments [List] :type A comma-separated list of document types *Deprecated*
27
14
  # @option arguments [Boolean] :include_type_name Whether a type should be returned in the body of the mappings.
28
15
  # @option arguments [Boolean] :include_defaults Whether the default mapping values should be returned as well
29
16
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
30
17
  # @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)
31
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
18
+ # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
19
+ # (options: open,closed,none,all)
20
+
32
21
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
22
+
33
23
  #
34
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html
24
+ # *Deprecation notice*:
25
+ # Specifying types in urls has been deprecated
26
+ # Deprecated since version 7.0.0
35
27
  #
36
- def get_field_mapping(arguments={})
28
+ #
29
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-get-field-mapping.html
30
+ #
31
+ def get_field_mapping(arguments = {})
32
+ _fields = arguments.delete(:field) || arguments.delete(:fields)
33
+ raise ArgumentError, "Required argument 'field' missing" unless _fields
34
+
37
35
  arguments = arguments.clone
38
- fields = arguments.delete(:field) || arguments.delete(:fields)
39
- raise ArgumentError, "Required argument 'field' missing" unless fields
40
- method = HTTP_GET
41
- path = Utils.__pathify(
42
- Utils.__listify(arguments[:index]),
43
- '_mapping',
44
- Utils.__listify(arguments[:type]),
45
- 'field',
46
- Utils.__listify(fields)
47
- )
36
+
37
+ _index = arguments.delete(:index)
38
+
39
+ _type = arguments.delete(:type)
40
+
41
+ method = Elasticsearch::API::HTTP_GET
42
+ path = if _index && _type && _fields
43
+ "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}/field/#{Utils.__listify(_fields)}"
44
+ elsif _index && _fields
45
+ "#{Utils.__listify(_index)}/_mapping/field/#{Utils.__listify(_fields)}"
46
+ elsif _type && _fields
47
+ "_mapping/#{Utils.__listify(_type)}/field/#{Utils.__listify(_fields)}"
48
+ else
49
+ "_mapping/field/#{Utils.__listify(_fields)}"
50
+ end
48
51
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
49
- body = nil
50
52
 
53
+ body = nil
51
54
  perform_request(method, path, params, body).body
52
55
  end
53
56
 
54
57
  # Register this action with its valid params when the module is loaded.
55
58
  #
56
- # @since 6.1.1
59
+ # @since 6.2.0
57
60
  ParamsRegistry.register(:get_field_mapping, [
58
- :include_type_name,
59
- :include_defaults,
60
- :ignore_unavailable,
61
- :allow_no_indices,
62
- :expand_wildcards,
63
- :local ].freeze)
61
+ :include_type_name,
62
+ :include_defaults,
63
+ :ignore_unavailable,
64
+ :allow_no_indices,
65
+ :expand_wildcards,
66
+ :local
67
+ ].freeze)
68
+ end
64
69
  end
65
- end
66
70
  end
67
71
  end
@@ -6,54 +6,62 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Return the mapping definitions for all indices, or specific indices/types.
11
- #
12
- # @example Get all mappings in the cluster
13
- #
14
- # client.indices.get_mapping
15
- #
16
- # @example Get mapping for a specific index
17
- #
18
- # client.indices.get_mapping index: 'foo'
19
- #
20
- # @example Get mapping for a specific type in a specific index
21
- #
22
- # client.indices.get_mapping index: 'foo', type: 'baz'
9
+ # Returns mappings for one or more indices.
23
10
  #
24
11
  # @option arguments [List] :index A comma-separated list of index names
25
- # @option arguments [List] :type A comma-separated list of document types
12
+ # @option arguments [List] :type A comma-separated list of document types *Deprecated*
26
13
  # @option arguments [Boolean] :include_type_name Whether to add the type name to the response (default: false)
27
14
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
28
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)
29
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
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
+
30
19
  # @option arguments [Time] :master_timeout Specify timeout for connection to master
31
20
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
21
+
32
22
  #
33
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html
23
+ # *Deprecation notice*:
24
+ # Specifying types in urls has been deprecated
25
+ # Deprecated since version 7.0.0
34
26
  #
35
- def get_mapping(arguments={})
36
- method = HTTP_GET
37
- path = Utils.__pathify Utils.__listify(arguments[:index]),
38
- '_mapping',
39
- Utils.__listify(arguments[:type])
27
+ #
28
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-get-mapping.html
29
+ #
30
+ def get_mapping(arguments = {})
31
+ arguments = arguments.clone
32
+
33
+ _index = arguments.delete(:index)
34
+
35
+ _type = arguments.delete(:type)
36
+
37
+ method = Elasticsearch::API::HTTP_GET
38
+ path = if _index && _type
39
+ "#{Utils.__listify(_index)}/_mapping/#{Utils.__listify(_type)}"
40
+ elsif _index
41
+ "#{Utils.__listify(_index)}/_mapping"
42
+ elsif _type
43
+ "_mapping/#{Utils.__listify(_type)}"
44
+ else
45
+ "_mapping"
46
+ end
40
47
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
41
- body = nil
42
48
 
49
+ body = nil
43
50
  perform_request(method, path, params, body).body
44
51
  end
45
52
 
46
53
  # Register this action with its valid params when the module is loaded.
47
54
  #
48
- # @since 6.1.1
55
+ # @since 6.2.0
49
56
  ParamsRegistry.register(:get_mapping, [
50
- :include_type_name,
51
- :ignore_unavailable,
52
- :allow_no_indices,
53
- :expand_wildcards,
54
- :master_timeout,
55
- :local ].freeze)
57
+ :include_type_name,
58
+ :ignore_unavailable,
59
+ :allow_no_indices,
60
+ :expand_wildcards,
61
+ :master_timeout,
62
+ :local
63
+ ].freeze)
64
+ end
56
65
  end
57
- end
58
66
  end
59
67
  end
@@ -6,62 +6,59 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Return the settings for all indices, or a list of indices.
11
- #
12
- # @example Get settings for all indices
13
- #
14
- # client.indices.get_settings
15
- #
16
- # @example Get settings for the 'foo' index
17
- #
18
- # client.indices.get_settings index: 'foo'
19
- #
20
- # @example Get settings for indices beginning with foo
21
- #
22
- # client.indices.get_settings prefix: 'foo'
23
- #
24
- # @example Get settings for an index named _myindex_
25
- #
26
- # client.indices.get_settings index: 'myindex'
9
+ # Returns settings for one or more indices.
27
10
  #
28
11
  # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
29
12
  # @option arguments [List] :name The name of the settings that should be included
30
13
  # @option arguments [Time] :master_timeout Specify timeout for connection to master
31
14
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
32
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)
33
- # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, none, all)
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
+
34
19
  # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
35
20
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
36
21
  # @option arguments [Boolean] :include_defaults Whether to return all default setting for each of the indices.
22
+
37
23
  #
38
- # @see https://www.elastic.co/guide/reference/api/admin-indices-get-settings/
24
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-get-settings.html
39
25
  #
40
- def get_settings(arguments={})
41
- method = HTTP_GET
42
- path = Utils.__pathify Utils.__listify(arguments[:index]),
43
- Utils.__listify(arguments[:type]),
44
- arguments.delete(:prefix),
45
- '_settings',
46
- Utils.__escape(arguments[:name])
26
+ def get_settings(arguments = {})
27
+ arguments = arguments.clone
28
+
29
+ _index = arguments.delete(:index)
30
+
31
+ _name = arguments.delete(:name)
32
+
33
+ method = Elasticsearch::API::HTTP_GET
34
+ path = if _index && _name
35
+ "#{Utils.__listify(_index)}/_settings/#{Utils.__listify(_name)}"
36
+ elsif _index
37
+ "#{Utils.__listify(_index)}/_settings"
38
+ elsif _name
39
+ "_settings/#{Utils.__listify(_name)}"
40
+ else
41
+ "_settings"
42
+ end
47
43
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
48
- body = nil
49
44
 
45
+ body = nil
50
46
  perform_request(method, path, params, body).body
51
47
  end
52
48
 
53
49
  # Register this action with its valid params when the module is loaded.
54
50
  #
55
- # @since 6.1.1
51
+ # @since 6.2.0
56
52
  ParamsRegistry.register(:get_settings, [
57
- :master_timeout,
58
- :ignore_unavailable,
59
- :allow_no_indices,
60
- :expand_wildcards,
61
- :flat_settings,
62
- :local,
63
- :include_defaults ].freeze)
53
+ :master_timeout,
54
+ :ignore_unavailable,
55
+ :allow_no_indices,
56
+ :expand_wildcards,
57
+ :flat_settings,
58
+ :local,
59
+ :include_defaults
60
+ ].freeze)
61
+ end
64
62
  end
65
- end
66
63
  end
67
64
  end
@@ -6,46 +6,44 @@ module Elasticsearch
6
6
  module API
7
7
  module Indices
8
8
  module Actions
9
-
10
- # Get a single index template.
11
- #
12
- # @example Get all templates
13
- #
14
- # client.indices.get_template
15
- #
16
- # @example Get a template named _mytemplate_
17
- #
18
- # client.indices.get_template name: 'mytemplate'
19
- #
20
- # @note Use the {Cluster::Actions#state} API to get a list of all templates.
9
+ # Returns an index template.
21
10
  #
22
11
  # @option arguments [List] :name The comma separated names of the index templates
23
12
  # @option arguments [Boolean] :include_type_name Whether a type should be returned in the body of the mappings.
24
13
  # @option arguments [Boolean] :flat_settings Return settings in flat format (default: false)
25
14
  # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
26
15
  # @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
16
+
27
17
  #
28
- # @see https://www.elastic.co/guide/reference/api/admin-indices-templates/
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-templates.html
29
19
  #
30
- def get_template(arguments={})
31
- method = HTTP_GET
32
- path = Utils.__pathify '_template', Utils.__escape(arguments[:name])
20
+ def get_template(arguments = {})
21
+ arguments = arguments.clone
22
+
23
+ _name = arguments.delete(:name)
33
24
 
25
+ method = Elasticsearch::API::HTTP_GET
26
+ path = if _name
27
+ "_template/#{Utils.__listify(_name)}"
28
+ else
29
+ "_template"
30
+ end
34
31
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
35
- body = arguments[:body]
36
32
 
33
+ body = nil
37
34
  perform_request(method, path, params, body).body
38
35
  end
39
36
 
40
37
  # Register this action with its valid params when the module is loaded.
41
38
  #
42
- # @since 6.1.1
39
+ # @since 6.2.0
43
40
  ParamsRegistry.register(:get_template, [
44
- :include_type_name,
45
- :flat_settings,
46
- :master_timeout,
47
- :local ].freeze)
41
+ :include_type_name,
42
+ :flat_settings,
43
+ :master_timeout,
44
+ :local
45
+ ].freeze)
46
+ end
48
47
  end
49
- end
50
48
  end
51
49
  end
@@ -0,0 +1,48 @@
1
+ # Licensed to Elasticsearch B.V under one or more agreements.
2
+ # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
+ # See the LICENSE file in the project root for more information
4
+
5
+ module Elasticsearch
6
+ module API
7
+ module Indices
8
+ module Actions
9
+ # The _upgrade API is no longer useful and will be removed.
10
+ #
11
+ # @option arguments [List] :index A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
12
+ # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
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)
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
+
17
+ #
18
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-upgrade.html
19
+ #
20
+ def get_upgrade(arguments = {})
21
+ arguments = arguments.clone
22
+
23
+ _index = arguments.delete(:index)
24
+
25
+ method = Elasticsearch::API::HTTP_GET
26
+ path = if _index
27
+ "#{Utils.__listify(_index)}/_upgrade"
28
+ else
29
+ "_upgrade"
30
+ end
31
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
32
+
33
+ body = nil
34
+ perform_request(method, path, params, body).body
35
+ end
36
+
37
+ # Register this action with its valid params when the module is loaded.
38
+ #
39
+ # @since 6.2.0
40
+ ParamsRegistry.register(:get_upgrade, [
41
+ :ignore_unavailable,
42
+ :allow_no_indices,
43
+ :expand_wildcards
44
+ ].freeze)
45
+ end
46
+ end
47
+ end
48
+ end