elasticsearch-serverless 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. checksums.yaml +4 -4
  2. data/lib/elasticsearch-serverless/api/async_search/delete.rb +3 -4
  3. data/lib/elasticsearch-serverless/api/async_search/get.rb +4 -5
  4. data/lib/elasticsearch-serverless/api/async_search/status.rb +11 -8
  5. data/lib/elasticsearch-serverless/api/async_search/submit.rb +6 -10
  6. data/lib/elasticsearch-serverless/api/bulk.rb +109 -22
  7. data/lib/elasticsearch-serverless/api/cat/aliases.rb +17 -18
  8. data/lib/elasticsearch-serverless/api/cat/component_templates.rb +17 -16
  9. data/lib/elasticsearch-serverless/api/cat/count.rb +13 -18
  10. data/lib/elasticsearch-serverless/api/cat/help.rb +5 -19
  11. data/lib/elasticsearch-serverless/api/cat/indices.rb +10 -15
  12. data/lib/elasticsearch-serverless/api/cat/ml_data_frame_analytics.rb +7 -17
  13. data/lib/elasticsearch-serverless/api/cat/ml_datafeeds.rb +6 -16
  14. data/lib/elasticsearch-serverless/api/cat/ml_jobs.rb +6 -16
  15. data/lib/elasticsearch-serverless/api/cat/ml_trained_models.rb +7 -16
  16. data/lib/elasticsearch-serverless/api/cat/transforms.rb +6 -16
  17. data/lib/elasticsearch-serverless/api/clear_scroll.rb +9 -7
  18. data/lib/elasticsearch-serverless/api/close_point_in_time.rb +8 -4
  19. data/lib/elasticsearch-serverless/api/cluster/delete_component_template.rb +3 -5
  20. data/lib/elasticsearch-serverless/api/cluster/exists_component_template.rb +4 -5
  21. data/lib/elasticsearch-serverless/api/cluster/get_component_template.rb +5 -6
  22. data/lib/elasticsearch-serverless/api/cluster/info.rb +3 -4
  23. data/lib/elasticsearch-serverless/api/cluster/put_component_template.rb +6 -5
  24. data/lib/elasticsearch-serverless/api/connector/check_in.rb +3 -4
  25. data/lib/elasticsearch-serverless/api/connector/delete.rb +4 -4
  26. data/lib/elasticsearch-serverless/api/connector/get.rb +5 -5
  27. data/lib/elasticsearch-serverless/api/connector/list.rb +4 -3
  28. data/lib/elasticsearch-serverless/api/connector/post.rb +3 -3
  29. data/lib/elasticsearch-serverless/api/connector/put.rb +4 -5
  30. data/lib/elasticsearch-serverless/api/connector/sync_job_cancel.rb +7 -6
  31. data/lib/elasticsearch-serverless/api/connector/sync_job_delete.rb +7 -6
  32. data/lib/elasticsearch-serverless/api/connector/sync_job_get.rb +7 -6
  33. data/lib/elasticsearch-serverless/api/connector/sync_job_list.rb +3 -3
  34. data/lib/elasticsearch-serverless/api/connector/sync_job_post.rb +3 -3
  35. data/lib/elasticsearch-serverless/api/connector/update_active_filtering.rb +3 -4
  36. data/lib/elasticsearch-serverless/api/connector/update_api_key_id.rb +3 -4
  37. data/lib/elasticsearch-serverless/api/connector/update_configuration.rb +3 -4
  38. data/lib/elasticsearch-serverless/api/connector/update_error.rb +3 -4
  39. data/lib/elasticsearch-serverless/api/connector/update_filtering.rb +3 -4
  40. data/lib/elasticsearch-serverless/api/connector/update_filtering_validation.rb +2 -3
  41. data/lib/elasticsearch-serverless/api/connector/update_index_name.rb +3 -4
  42. data/lib/elasticsearch-serverless/api/connector/update_name.rb +3 -4
  43. data/lib/elasticsearch-serverless/api/connector/update_native.rb +2 -3
  44. data/lib/elasticsearch-serverless/api/connector/update_pipeline.rb +3 -4
  45. data/lib/elasticsearch-serverless/api/connector/update_scheduling.rb +3 -4
  46. data/lib/elasticsearch-serverless/api/connector/update_service_type.rb +3 -4
  47. data/lib/elasticsearch-serverless/api/connector/update_status.rb +3 -4
  48. data/lib/elasticsearch-serverless/api/count.rb +36 -25
  49. data/lib/elasticsearch-serverless/api/create.rb +77 -22
  50. data/lib/elasticsearch-serverless/api/delete.rb +44 -18
  51. data/lib/elasticsearch-serverless/api/delete_by_query.rb +91 -29
  52. data/lib/elasticsearch-serverless/api/delete_script.rb +10 -9
  53. data/lib/elasticsearch-serverless/api/enrich/delete_policy.rb +5 -5
  54. data/lib/elasticsearch-serverless/api/enrich/execute_policy.rb +6 -5
  55. data/lib/elasticsearch-serverless/api/enrich/get_policy.rb +6 -6
  56. data/lib/elasticsearch-serverless/api/enrich/put_policy.rb +5 -5
  57. data/lib/elasticsearch-serverless/api/eql/delete.rb +5 -5
  58. data/lib/elasticsearch-serverless/api/eql/get.rb +5 -5
  59. data/lib/elasticsearch-serverless/api/eql/get_status.rb +5 -5
  60. data/lib/elasticsearch-serverless/api/eql/search.rb +9 -5
  61. data/lib/elasticsearch-serverless/api/exists.rb +38 -19
  62. data/lib/elasticsearch-serverless/api/exists_source.rb +23 -18
  63. data/lib/elasticsearch-serverless/api/explain.rb +25 -16
  64. data/lib/elasticsearch-serverless/api/field_caps.rb +16 -13
  65. data/lib/elasticsearch-serverless/api/get.rb +71 -21
  66. data/lib/elasticsearch-serverless/api/get_script.rb +7 -6
  67. data/lib/elasticsearch-serverless/api/get_source.rb +25 -15
  68. data/lib/elasticsearch-serverless/api/graph/explore.rb +9 -5
  69. data/lib/elasticsearch-serverless/api/index.rb +110 -21
  70. data/lib/elasticsearch-serverless/api/indices/add_block.rb +23 -12
  71. data/lib/elasticsearch-serverless/api/indices/analyze.rb +9 -6
  72. data/lib/elasticsearch-serverless/api/indices/create.rb +19 -6
  73. data/lib/elasticsearch-serverless/api/indices/create_data_stream.rb +3 -5
  74. data/lib/elasticsearch-serverless/api/indices/delete.rb +11 -8
  75. data/lib/elasticsearch-serverless/api/indices/delete_alias.rb +4 -7
  76. data/lib/elasticsearch-serverless/api/indices/delete_data_stream.rb +3 -4
  77. data/lib/elasticsearch-serverless/api/indices/delete_index_template.rb +3 -4
  78. data/lib/elasticsearch-serverless/api/indices/exists.rb +7 -8
  79. data/lib/elasticsearch-serverless/api/indices/exists_alias.rb +8 -8
  80. data/lib/elasticsearch-serverless/api/indices/exists_index_template.rb +6 -6
  81. data/lib/elasticsearch-serverless/api/indices/explain_data_lifecycle.rb +4 -5
  82. data/lib/elasticsearch-serverless/api/indices/get.rb +5 -6
  83. data/lib/elasticsearch-serverless/api/indices/get_alias.rb +6 -6
  84. data/lib/elasticsearch-serverless/api/indices/get_data_lifecycle.rb +4 -5
  85. data/lib/elasticsearch-serverless/api/indices/get_data_stream.rb +5 -6
  86. data/lib/elasticsearch-serverless/api/indices/get_index_template.rb +5 -6
  87. data/lib/elasticsearch-serverless/api/indices/get_mapping.rb +4 -6
  88. data/lib/elasticsearch-serverless/api/indices/get_settings.rb +6 -7
  89. data/lib/elasticsearch-serverless/api/indices/migrate_to_data_stream.rb +3 -4
  90. data/lib/elasticsearch-serverless/api/indices/modify_data_stream.rb +3 -3
  91. data/lib/elasticsearch-serverless/api/indices/put_alias.rb +4 -7
  92. data/lib/elasticsearch-serverless/api/indices/put_data_lifecycle.rb +4 -6
  93. data/lib/elasticsearch-serverless/api/indices/put_index_template.rb +22 -4
  94. data/lib/elasticsearch-serverless/api/indices/put_mapping.rb +21 -6
  95. data/lib/elasticsearch-serverless/api/indices/put_settings.rb +17 -7
  96. data/lib/elasticsearch-serverless/api/indices/refresh.rb +11 -5
  97. data/lib/elasticsearch-serverless/api/indices/resolve_index.rb +5 -5
  98. data/lib/elasticsearch-serverless/api/indices/rollover.rb +28 -5
  99. data/lib/elasticsearch-serverless/api/indices/simulate_index_template.rb +4 -5
  100. data/lib/elasticsearch-serverless/api/indices/simulate_template.rb +5 -6
  101. data/lib/elasticsearch-serverless/api/indices/update_aliases.rb +3 -3
  102. data/lib/elasticsearch-serverless/api/indices/validate_query.rb +4 -5
  103. data/lib/elasticsearch-serverless/api/inference/chat_completion_unified.rb +62 -0
  104. data/lib/elasticsearch-serverless/api/inference/completion.rb +62 -0
  105. data/lib/elasticsearch-serverless/api/inference/delete.rb +6 -11
  106. data/lib/elasticsearch-serverless/api/inference/get.rb +4 -9
  107. data/lib/elasticsearch-serverless/api/inference/inference.rb +0 -4
  108. data/lib/elasticsearch-serverless/api/inference/put.rb +12 -9
  109. data/lib/elasticsearch-serverless/api/inference/put_watsonx.rb +78 -0
  110. data/lib/elasticsearch-serverless/api/inference/rerank.rb +62 -0
  111. data/lib/elasticsearch-serverless/api/inference/sparse_embedding.rb +62 -0
  112. data/lib/elasticsearch-serverless/api/inference/text_embedding.rb +62 -0
  113. data/lib/elasticsearch-serverless/api/info.rb +4 -4
  114. data/lib/elasticsearch-serverless/api/ingest/delete_pipeline.rb +5 -5
  115. data/lib/elasticsearch-serverless/api/ingest/get_pipeline.rb +6 -6
  116. data/lib/elasticsearch-serverless/api/ingest/processor_grok.rb +5 -4
  117. data/lib/elasticsearch-serverless/api/ingest/put_pipeline.rb +3 -4
  118. data/lib/elasticsearch-serverless/api/ingest/simulate.rb +9 -8
  119. data/lib/elasticsearch-serverless/api/license/get.rb +4 -5
  120. data/lib/elasticsearch-serverless/api/logstash/delete_pipeline.rb +7 -6
  121. data/lib/elasticsearch-serverless/api/logstash/get_pipeline.rb +7 -7
  122. data/lib/elasticsearch-serverless/api/logstash/put_pipeline.rb +7 -6
  123. data/lib/elasticsearch-serverless/api/machine_learning/close_job.rb +3 -4
  124. data/lib/elasticsearch-serverless/api/machine_learning/delete_calendar.rb +4 -5
  125. data/lib/elasticsearch-serverless/api/machine_learning/delete_calendar_event.rb +3 -4
  126. data/lib/elasticsearch-serverless/api/machine_learning/delete_calendar_job.rb +3 -4
  127. data/lib/elasticsearch-serverless/api/machine_learning/delete_data_frame_analytics.rb +3 -4
  128. data/lib/elasticsearch-serverless/api/machine_learning/delete_datafeed.rb +3 -4
  129. data/lib/elasticsearch-serverless/api/machine_learning/delete_filter.rb +3 -4
  130. data/lib/elasticsearch-serverless/api/machine_learning/delete_job.rb +3 -4
  131. data/lib/elasticsearch-serverless/api/machine_learning/delete_trained_model.rb +4 -4
  132. data/lib/elasticsearch-serverless/api/machine_learning/delete_trained_model_alias.rb +3 -4
  133. data/lib/elasticsearch-serverless/api/machine_learning/estimate_model_memory.rb +5 -5
  134. data/lib/elasticsearch-serverless/api/machine_learning/evaluate_data_frame.rb +3 -3
  135. data/lib/elasticsearch-serverless/api/machine_learning/flush_job.rb +3 -4
  136. data/lib/elasticsearch-serverless/api/machine_learning/get_calendar_events.rb +3 -4
  137. data/lib/elasticsearch-serverless/api/machine_learning/get_calendars.rb +4 -5
  138. data/lib/elasticsearch-serverless/api/machine_learning/get_data_frame_analytics.rb +4 -5
  139. data/lib/elasticsearch-serverless/api/machine_learning/get_data_frame_analytics_stats.rb +4 -5
  140. data/lib/elasticsearch-serverless/api/machine_learning/get_datafeed_stats.rb +4 -5
  141. data/lib/elasticsearch-serverless/api/machine_learning/get_datafeeds.rb +4 -5
  142. data/lib/elasticsearch-serverless/api/machine_learning/get_filters.rb +4 -5
  143. data/lib/elasticsearch-serverless/api/machine_learning/get_job_stats.rb +4 -5
  144. data/lib/elasticsearch-serverless/api/machine_learning/get_jobs.rb +4 -5
  145. data/lib/elasticsearch-serverless/api/machine_learning/get_overall_buckets.rb +3 -4
  146. data/lib/elasticsearch-serverless/api/machine_learning/get_trained_models.rb +4 -5
  147. data/lib/elasticsearch-serverless/api/machine_learning/get_trained_models_stats.rb +4 -5
  148. data/lib/elasticsearch-serverless/api/machine_learning/infer_trained_model.rb +3 -9
  149. data/lib/elasticsearch-serverless/api/machine_learning/open_job.rb +3 -4
  150. data/lib/elasticsearch-serverless/api/machine_learning/post_calendar_events.rb +3 -4
  151. data/lib/elasticsearch-serverless/api/machine_learning/preview_data_frame_analytics.rb +5 -6
  152. data/lib/elasticsearch-serverless/api/machine_learning/preview_datafeed.rb +4 -5
  153. data/lib/elasticsearch-serverless/api/machine_learning/put_calendar.rb +3 -4
  154. data/lib/elasticsearch-serverless/api/machine_learning/put_calendar_job.rb +3 -4
  155. data/lib/elasticsearch-serverless/api/machine_learning/put_data_frame_analytics.rb +6 -4
  156. data/lib/elasticsearch-serverless/api/machine_learning/put_datafeed.rb +6 -6
  157. data/lib/elasticsearch-serverless/api/machine_learning/put_filter.rb +3 -4
  158. data/lib/elasticsearch-serverless/api/machine_learning/put_job.rb +16 -5
  159. data/lib/elasticsearch-serverless/api/machine_learning/put_trained_model.rb +3 -4
  160. data/lib/elasticsearch-serverless/api/machine_learning/put_trained_model_alias.rb +3 -4
  161. data/lib/elasticsearch-serverless/api/machine_learning/put_trained_model_definition_part.rb +3 -4
  162. data/lib/elasticsearch-serverless/api/machine_learning/put_trained_model_vocabulary.rb +3 -4
  163. data/lib/elasticsearch-serverless/api/machine_learning/reset_job.rb +3 -4
  164. data/lib/elasticsearch-serverless/api/machine_learning/start_data_frame_analytics.rb +3 -4
  165. data/lib/elasticsearch-serverless/api/machine_learning/start_datafeed.rb +3 -4
  166. data/lib/elasticsearch-serverless/api/machine_learning/start_trained_model_deployment.rb +7 -6
  167. data/lib/elasticsearch-serverless/api/machine_learning/stop_data_frame_analytics.rb +3 -4
  168. data/lib/elasticsearch-serverless/api/machine_learning/stop_datafeed.rb +3 -4
  169. data/lib/elasticsearch-serverless/api/machine_learning/stop_trained_model_deployment.rb +3 -4
  170. data/lib/elasticsearch-serverless/api/machine_learning/update_data_frame_analytics.rb +3 -4
  171. data/lib/elasticsearch-serverless/api/machine_learning/update_datafeed.rb +3 -4
  172. data/lib/elasticsearch-serverless/api/machine_learning/update_filter.rb +3 -4
  173. data/lib/elasticsearch-serverless/api/machine_learning/update_job.rb +3 -4
  174. data/lib/elasticsearch-serverless/api/machine_learning/update_trained_model_deployment.rb +3 -4
  175. data/lib/elasticsearch-serverless/api/mget.rb +12 -5
  176. data/lib/elasticsearch-serverless/api/msearch.rb +16 -17
  177. data/lib/elasticsearch-serverless/api/msearch_template.rb +23 -16
  178. data/lib/elasticsearch-serverless/api/mtermvectors.rb +15 -12
  179. data/lib/elasticsearch-serverless/api/open_point_in_time.rb +33 -11
  180. data/lib/elasticsearch-serverless/api/ping.rb +8 -10
  181. data/lib/elasticsearch-serverless/api/put_script.rb +12 -11
  182. data/lib/elasticsearch-serverless/api/query_rules/delete_rule.rb +6 -5
  183. data/lib/elasticsearch-serverless/api/query_rules/delete_ruleset.rb +6 -5
  184. data/lib/elasticsearch-serverless/api/query_rules/get_rule.rb +5 -5
  185. data/lib/elasticsearch-serverless/api/query_rules/get_ruleset.rb +5 -5
  186. data/lib/elasticsearch-serverless/api/query_rules/list_rulesets.rb +7 -6
  187. data/lib/elasticsearch-serverless/api/query_rules/put_rule.rb +11 -7
  188. data/lib/elasticsearch-serverless/api/query_rules/put_ruleset.rb +11 -6
  189. data/lib/elasticsearch-serverless/api/query_rules/test.rb +5 -5
  190. data/lib/elasticsearch-serverless/api/rank_eval.rb +8 -7
  191. data/lib/elasticsearch-serverless/api/reindex.rb +146 -9
  192. data/lib/elasticsearch-serverless/api/render_search_template.rb +7 -7
  193. data/lib/elasticsearch-serverless/api/response.rb +1 -1
  194. data/lib/elasticsearch-serverless/api/scripts_painless_execute.rb +7 -3
  195. data/lib/elasticsearch-serverless/api/scroll.rb +4 -4
  196. data/lib/elasticsearch-serverless/api/search.rb +79 -72
  197. data/lib/elasticsearch-serverless/api/search_application/delete.rb +4 -5
  198. data/lib/elasticsearch-serverless/api/search_application/delete_behavioral_analytics.rb +3 -4
  199. data/lib/elasticsearch-serverless/api/search_application/get.rb +3 -4
  200. data/lib/elasticsearch-serverless/api/search_application/get_behavioral_analytics.rb +4 -5
  201. data/lib/elasticsearch-serverless/api/search_application/list.rb +5 -4
  202. data/lib/elasticsearch-serverless/api/search_application/put.rb +3 -4
  203. data/lib/elasticsearch-serverless/api/search_application/put_behavioral_analytics.rb +3 -4
  204. data/lib/elasticsearch-serverless/api/search_application/search.rb +3 -4
  205. data/lib/elasticsearch-serverless/api/search_mvt.rb +132 -10
  206. data/lib/elasticsearch-serverless/api/search_template.rb +13 -13
  207. data/lib/elasticsearch-serverless/api/security/authenticate.rb +3 -3
  208. data/lib/elasticsearch-serverless/api/security/create_api_key.rb +7 -3
  209. data/lib/elasticsearch-serverless/api/security/delete_role.rb +6 -5
  210. data/lib/elasticsearch-serverless/api/security/get_api_key.rb +3 -3
  211. data/lib/elasticsearch-serverless/api/security/get_builtin_privileges.rb +3 -3
  212. data/lib/elasticsearch-serverless/api/security/get_role.rb +11 -8
  213. data/lib/elasticsearch-serverless/api/security/has_privileges.rb +6 -5
  214. data/lib/elasticsearch-serverless/api/security/invalidate_api_key.rb +8 -6
  215. data/lib/elasticsearch-serverless/api/security/put_role.rb +3 -4
  216. data/lib/elasticsearch-serverless/api/security/query_api_keys.rb +12 -6
  217. data/lib/elasticsearch-serverless/api/security/query_role.rb +61 -0
  218. data/lib/elasticsearch-serverless/api/security/update_api_key.rb +74 -0
  219. data/lib/elasticsearch-serverless/api/sql/clear_cursor.rb +4 -4
  220. data/lib/elasticsearch-serverless/api/sql/delete_async.rb +10 -6
  221. data/lib/elasticsearch-serverless/api/sql/get_async.rb +16 -13
  222. data/lib/elasticsearch-serverless/api/sql/get_async_status.rb +6 -6
  223. data/lib/elasticsearch-serverless/api/sql/query.rb +8 -5
  224. data/lib/elasticsearch-serverless/api/sql/translate.rb +6 -4
  225. data/lib/elasticsearch-serverless/api/synonyms/delete_synonym.rb +17 -6
  226. data/lib/elasticsearch-serverless/api/synonyms/delete_synonym_rule.rb +7 -7
  227. data/lib/elasticsearch-serverless/api/synonyms/get_synonym.rb +7 -8
  228. data/lib/elasticsearch-serverless/api/synonyms/get_synonym_rule.rb +7 -7
  229. data/lib/elasticsearch-serverless/api/synonyms/get_synonyms_sets.rb +7 -6
  230. data/lib/elasticsearch-serverless/api/synonyms/put_synonym.rb +9 -6
  231. data/lib/elasticsearch-serverless/api/synonyms/put_synonym_rule.rb +9 -7
  232. data/lib/elasticsearch-serverless/api/tasks/get.rb +9 -7
  233. data/lib/elasticsearch-serverless/api/terms_enum.rb +7 -9
  234. data/lib/elasticsearch-serverless/api/termvectors.rb +40 -17
  235. data/lib/elasticsearch-serverless/api/transform/delete_transform.rb +3 -5
  236. data/lib/elasticsearch-serverless/api/transform/get_transform.rb +5 -6
  237. data/lib/elasticsearch-serverless/api/transform/get_transform_stats.rb +4 -5
  238. data/lib/elasticsearch-serverless/api/transform/preview_transform.rb +4 -5
  239. data/lib/elasticsearch-serverless/api/transform/put_transform.rb +3 -4
  240. data/lib/elasticsearch-serverless/api/transform/reset_transform.rb +4 -5
  241. data/lib/elasticsearch-serverless/api/transform/schedule_now_transform.rb +7 -8
  242. data/lib/elasticsearch-serverless/api/transform/start_transform.rb +3 -5
  243. data/lib/elasticsearch-serverless/api/transform/stop_transform.rb +3 -4
  244. data/lib/elasticsearch-serverless/api/transform/update_transform.rb +3 -4
  245. data/lib/elasticsearch-serverless/api/update.rb +36 -24
  246. data/lib/elasticsearch-serverless/api/update_by_query.rb +102 -31
  247. data/lib/elasticsearch-serverless/api.rb +22 -25
  248. data/lib/elasticsearch-serverless/version.rb +1 -1
  249. data/lib/elasticsearch-serverless.rb +7 -0
  250. metadata +18 -7
@@ -21,44 +21,133 @@
21
21
  module ElasticsearchServerless
22
22
  module API
23
23
  module Actions
24
- # Index a document.
25
- # Adds a JSON document to the specified data stream or index and makes it searchable.
24
+ # Create or update a document in an index.
25
+ # Add a JSON document to the specified data stream or index and make it searchable.
26
26
  # If the target is an index and the document already exists, the request updates the document and increments its version.
27
+ # NOTE: You cannot use this API to send update requests for existing documents in a data stream.
28
+ # If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:
29
+ # * To add or overwrite a document using the +PUT /<target>/_doc/<_id>+ request format, you must have the +create+, +index+, or +write+ index privilege.
30
+ # * To add a document using the +POST /<target>/_doc/+ request format, you must have the +create_doc+, +create+, +index+, or +write+ index privilege.
31
+ # * To automatically create a data stream or index with this API request, you must have the +auto_configure+, +create_index+, or +manage+ index privilege.
32
+ # Automatic data stream creation requires a matching index template with data stream enabled.
33
+ # NOTE: Replica shards might not all be started when an indexing operation returns successfully.
34
+ # By default, only the primary is required. Set +wait_for_active_shards+ to change this default behavior.
35
+ # **Automatically create data streams and indices**
36
+ # If the request's target doesn't exist and matches an index template with a +data_stream+ definition, the index operation automatically creates the data stream.
37
+ # If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.
38
+ # NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.
39
+ # If no mapping exists, the index operation creates a dynamic mapping.
40
+ # By default, new fields and objects are automatically added to the mapping if needed.
41
+ # Automatic index creation is controlled by the +action.auto_create_index+ setting.
42
+ # If it is +true+, any index can be created automatically.
43
+ # You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to +false+ to turn off automatic index creation entirely.
44
+ # Specify a comma-separated list of patterns you want to allow or prefix each pattern with +++ or +-+ to indicate whether it should be allowed or blocked.
45
+ # When a list is specified, the default behaviour is to disallow.
46
+ # NOTE: The +action.auto_create_index+ setting affects the automatic creation of indices only.
47
+ # It does not affect the creation of data streams.
48
+ # **Optimistic concurrency control**
49
+ # Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the +if_seq_no+ and +if_primary_term+ parameters.
50
+ # If a mismatch is detected, the operation will result in a +VersionConflictException+ and a status code of +409+.
51
+ # **Routing**
52
+ # By default, shard placement — or routing — is controlled by using a hash of the document's ID value.
53
+ # For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the +routing+ parameter.
54
+ # When setting up explicit mapping, you can also use the +_routing+ field to direct the index operation to extract the routing value from the document itself.
55
+ # This does come at the (very minimal) cost of an additional document parsing pass.
56
+ # If the +_routing+ mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.
57
+ # NOTE: Data streams do not support custom routing unless they were created with the +allow_custom_routing+ setting enabled in the template.
58
+ # **Distributed**
59
+ # The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard.
60
+ # After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.
61
+ # **Active shards**
62
+ # To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation.
63
+ # If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs.
64
+ # By default, write operations only wait for the primary shards to be active before proceeding (that is to say +wait_for_active_shards+ is +1+).
65
+ # This default can be overridden in the index settings dynamically by setting +index.write.wait_for_active_shards+.
66
+ # To alter this behavior per operation, use the +wait_for_active_shards request+ parameter.
67
+ # Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is +number_of_replicas++1).
68
+ # Specifying a negative value or a number greater than the number of shard copies will throw an error.
69
+ # For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes).
70
+ # If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding.
71
+ # This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data.
72
+ # If +wait_for_active_shards+ is set on the request to +3+ (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding.
73
+ # This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard.
74
+ # However, if you set +wait_for_active_shards+ to +all+ (or to +4+, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index.
75
+ # The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.
76
+ # It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts.
77
+ # After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary.
78
+ # The +_shards+ section of the API response reveals the number of shard copies on which replication succeeded and failed.
79
+ # **No operation (noop) updates**
80
+ # When updating a document by using this API, a new version of the document is always created even if the document hasn't changed.
81
+ # If this isn't acceptable use the +_update+ API with +detect_noop+ set to +true+.
82
+ # The +detect_noop+ option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source.
83
+ # There isn't a definitive rule for when noop updates aren't acceptable.
84
+ # It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates.
85
+ # **Versioning**
86
+ # Each indexed document is given a version number.
87
+ # By default, internal versioning is used that starts at 1 and increments with each update, deletes included.
88
+ # Optionally, the version number can be set to an external value (for example, if maintained in a database).
89
+ # To enable this functionality, +version_type+ should be set to +external+.
90
+ # The value provided must be a numeric, long value greater than or equal to 0, and less than around +9.2e+18+.
91
+ # NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations.
92
+ # If no version is provided, the operation runs without any version checks.
93
+ # When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document.
94
+ # If true, the document will be indexed and the new version number used.
95
+ # If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example:
96
+ # ```
97
+ # PUT my-index-000001/_doc/1?version=2&version_type=external
98
+ # {
99
+ # "user": {
100
+ # "id": "elkbee"
101
+ # }
102
+ # }
103
+ # In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
104
+ # If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
105
+ # A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
106
+ # Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
27
107
  #
28
- # @option arguments [String] :id Unique identifier for the document.
29
- # @option arguments [String] :index Name of the data stream or index to target. (*Required*)
108
+ # @option arguments [String] :id A unique identifier for the document.
109
+ # To automatically generate a document ID, use the +POST /<target>/_doc/+ request format and omit this parameter.
110
+ # @option arguments [String] :index The name of the data stream or index to target.
111
+ # If the target doesn't exist and matches the name or wildcard (+*+) pattern of an index template with a +data_stream+ definition, this request creates the data stream.
112
+ # If the target doesn't exist and doesn't match a data stream template, this request creates the index.
113
+ # You can check for existing targets with the resolve index API. (*Required*)
30
114
  # @option arguments [Integer] :if_primary_term Only perform the operation if the document has this primary term.
31
115
  # @option arguments [Integer] :if_seq_no Only perform the operation if the document has this sequence number.
32
- # @option arguments [String] :op_type Set to create to only index the document if it does not already exist (put if absent).
116
+ # @option arguments [Boolean] :include_source_on_error True or false if to include the document source in the error message in case of parsing errors. Server default: true.
117
+ # @option arguments [String] :op_type Set to +create+ to only index the document if it does not already exist (put if absent).
33
118
  # If a document with the specified +_id+ already exists, the indexing operation will fail.
34
- # Same as using the +<index>/_create+ endpoint.
35
- # Valid values: +index+, +create+.
36
- # If document id is specified, it defaults to +index+.
119
+ # The behavior is the same as using the +<index>/_create+ endpoint.
120
+ # If a document ID is specified, this paramater defaults to +index+.
37
121
  # Otherwise, it defaults to +create+.
38
- # @option arguments [String] :pipeline ID of the pipeline to use to preprocess incoming documents.
122
+ # If the request targets a data stream, an +op_type+ of +create+ is required.
123
+ # @option arguments [String] :pipeline The ID of the pipeline to use to preprocess incoming documents.
39
124
  # If the index has a default ingest pipeline specified, then setting the value to +_none+ disables the default ingest pipeline for this request.
40
125
  # If a final pipeline is configured it will always run, regardless of the value of this parameter.
41
- # @option arguments [String] :refresh If +true+, Elasticsearch refreshes 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+ do nothing with refreshes.
42
- # Valid values: +true+, +false+, +wait_for+.
43
- # @option arguments [String] :routing Custom value used to route operations to a specific shard.
44
- # @option arguments [Time] :timeout Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. Server default: 1m.
45
- # @option arguments [Integer] :version Explicit version number for concurrency control.
46
- # The specified version must match the current version of the document for the request to succeed.
47
- # @option arguments [String] :version_type Specific version type: +external+, +external_gte+.
126
+ # @option arguments [String] :refresh If +true+, Elasticsearch refreshes the affected shards to make this operation visible to search.
127
+ # If +wait_for+, it waits for a refresh to make this operation visible to search.
128
+ # If +false+, it does nothing with refreshes. Server default: false.
129
+ # @option arguments [String] :routing A custom value that is used to route operations to a specific shard.
130
+ # @option arguments [Time] :timeout The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs.
131
+ # Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation.
132
+ # By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error.
133
+ # The actual wait time could be longer, particularly when multiple waits occur. Server default: 1m.
134
+ # @option arguments [Integer] :version An explicit version number for concurrency control.
135
+ # It must be a non-negative long number.
136
+ # @option arguments [String] :version_type The version type.
48
137
  # @option arguments [Integer, String] :wait_for_active_shards The number of shard copies that must be active before proceeding with the operation.
49
- # Set to all or any positive integer up to the total number of shards in the index (+number_of_replicas+1+). Server default: 1.
138
+ # You can set it to +all+ or any positive integer up to the total number of shards in the index (+number_of_replicas+1+).
139
+ # The default value of +1+ means it waits for each primary shard to be active. Server default: 1.
50
140
  # @option arguments [Boolean] :require_alias If +true+, the destination must be an index alias.
51
141
  # @option arguments [Hash] :headers Custom HTTP headers
52
142
  # @option arguments [Hash] :body document
53
143
  #
54
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html
144
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create
55
145
  #
56
146
  def index(arguments = {})
57
- request_opts = { endpoint: arguments[:endpoint] || "index" }
147
+ request_opts = { endpoint: arguments[:endpoint] || 'index' }
58
148
 
59
- defined_params = [:index, :id].inject({}) do |set_variables, variable|
149
+ defined_params = [:index, :id].each_with_object({}) do |variable, set_variables|
60
150
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
61
- set_variables
62
151
  end
63
152
  request_opts[:defined_params] = defined_params unless defined_params.empty?
64
153
 
@@ -23,25 +23,36 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Add an index block.
26
- # Limits the operations allowed on an index by blocking specific operation types.
26
+ # Add an index block to an index.
27
+ # Index blocks limit the operations allowed on an index by blocking specific operation types.
27
28
  #
28
- # @option arguments [String] :index A comma separated list of indices to add a block to (*Required*)
29
- # @option arguments [String] :block The block to add (one of read, write, read_only or metadata) (*Required*)
30
- # @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, Array<String>] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
32
- # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
33
- # @option arguments [Time] :master_timeout Specify timeout for connection to master
34
- # @option arguments [Time] :timeout Explicit operation timeout
29
+ # @option arguments [String] :index A comma-separated list or wildcard expression of index names used to limit the request.
30
+ # By default, you must explicitly name the indices you are adding blocks to.
31
+ # To allow the adding of blocks to indices with +_all+, +*+, or other wildcard expressions, change the +action.destructive_requires_name+ setting to +false+.
32
+ # You can update this setting in the +elasticsearch.yml+ file or by using the cluster update settings API. (*Required*)
33
+ # @option arguments [String] :block The block type to add to the index. (*Required*)
34
+ # @option arguments [Boolean] :allow_no_indices If +false+, the request returns an error if any wildcard expression, index alias, or +_all+ value targets only missing or closed indices.
35
+ # This behavior applies even if the request targets other open indices.
36
+ # For example, a request targeting +foo*,bar*+ returns an error if an index starts with +foo+ but no index starts with +bar+. Server default: true.
37
+ # @option arguments [String, Array<String>] :expand_wildcards The type of index that wildcard patterns can match.
38
+ # If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.
39
+ # It supports comma-separated values, such as +open,hidden+. Server default: open.
40
+ # @option arguments [Boolean] :ignore_unavailable If +false+, the request returns an error if it targets a missing or closed index.
41
+ # @option arguments [Time] :master_timeout The period to wait for the master node.
42
+ # If the master node is not available before the timeout expires, the request fails and returns an error.
43
+ # It can also be set to +-1+ to indicate that the request should never timeout. Server default: 30s.
44
+ # @option arguments [Time] :timeout The period to wait for a response from all relevant nodes in the cluster after updating the cluster metadata.
45
+ # If no response is received before the timeout expires, the cluster metadata update still applies but the response will indicate that it was not completely acknowledged.
46
+ # It can also be set to +-1+ to indicate that the request should never timeout. Server default: 30s.
35
47
  # @option arguments [Hash] :headers Custom HTTP headers
36
48
  #
37
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-modules-blocks.html
49
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-add-block
38
50
  #
39
51
  def add_block(arguments = {})
40
- request_opts = { endpoint: arguments[:endpoint] || "indices.add_block" }
52
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.add_block' }
41
53
 
42
- defined_params = [:index, :block].inject({}) do |set_variables, variable|
54
+ defined_params = [:index, :block].each_with_object({}) do |variable, set_variables|
43
55
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
44
- set_variables
45
56
  end
46
57
  request_opts[:defined_params] = defined_params unless defined_params.empty?
47
58
 
@@ -23,7 +23,11 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Get tokens from text analysis.
26
- # The analyze API performs {https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html analysis} on a text string and returns the resulting tokens.
26
+ # The analyze API performs analysis on a text string and returns the resulting tokens.
27
+ # Generating excessive amount of tokens may cause a node to run out of memory.
28
+ # The +index.analyze.max_token_count+ setting enables you to limit the number of tokens that can be produced.
29
+ # If more than this limit of tokens gets generated, an error occurs.
30
+ # The +_analyze+ endpoint without a specified index will always use +10000+ as its limit.
27
31
  #
28
32
  # @option arguments [String] :index Index used to derive the analyzer.
29
33
  # If specified, the +analyzer+ or field parameter overrides this value.
@@ -31,14 +35,13 @@ module ElasticsearchServerless
31
35
  # @option arguments [Hash] :headers Custom HTTP headers
32
36
  # @option arguments [Hash] :body request body
33
37
  #
34
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html
38
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-analyze
35
39
  #
36
40
  def analyze(arguments = {})
37
- request_opts = { endpoint: arguments[:endpoint] || "indices.analyze" }
41
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.analyze' }
38
42
 
39
- defined_params = [:index].inject({}) do |set_variables, variable|
43
+ defined_params = [:index].each_with_object({}) do |variable, set_variables|
40
44
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
41
- set_variables
42
45
  end
43
46
  request_opts[:defined_params] = defined_params unless defined_params.empty?
44
47
 
@@ -58,7 +61,7 @@ module ElasticsearchServerless
58
61
  path = if _index
59
62
  "#{Utils.listify(_index)}/_analyze"
60
63
  else
61
- "_analyze"
64
+ '_analyze'
62
65
  end
63
66
  params = {}
64
67
 
@@ -23,7 +23,21 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Create an index.
26
- # Creates a new index.
26
+ # You can use the create index API to add a new index to an Elasticsearch cluster.
27
+ # When creating an index, you can specify the following:
28
+ # * Settings for the index.
29
+ # * Mappings for fields in the index.
30
+ # * Index aliases
31
+ # **Wait for active shards**
32
+ # By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out.
33
+ # The index creation response will indicate what happened.
34
+ # For example, +acknowledged+ indicates whether the index was successfully created in the cluster, +while shards_acknowledged+ indicates whether the requisite number of shard copies were started for each shard in the index before timing out.
35
+ # Note that it is still possible for either +acknowledged+ or +shards_acknowledged+ to be +false+, but for the index creation to be successful.
36
+ # These values simply indicate whether the operation completed before the timeout.
37
+ # If +acknowledged+ is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon.
38
+ # If +shards_acknowledged+ is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, +acknowledged+ is +true+).
39
+ # You can change the default of only waiting for the primary shards to start through the index setting +index.write.wait_for_active_shards+.
40
+ # Note that changing this setting will also affect the +wait_for_active_shards+ value on all subsequent write operations.
27
41
  #
28
42
  # @option arguments [String] :index Name of the index you wish to create. (*Required*)
29
43
  # @option arguments [Time] :master_timeout Period to wait for a connection to the master node.
@@ -35,14 +49,13 @@ module ElasticsearchServerless
35
49
  # @option arguments [Hash] :headers Custom HTTP headers
36
50
  # @option arguments [Hash] :body request body
37
51
  #
38
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html
52
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-create
39
53
  #
40
54
  def create(arguments = {})
41
- request_opts = { endpoint: arguments[:endpoint] || "indices.create" }
55
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.create' }
42
56
 
43
- defined_params = [:index].inject({}) do |set_variables, variable|
57
+ defined_params = [:index].each_with_object({}) do |variable, set_variables|
44
58
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
45
- set_variables
46
59
  end
47
60
  request_opts[:defined_params] = defined_params unless defined_params.empty?
48
61
 
@@ -56,7 +69,7 @@ module ElasticsearchServerless
56
69
  _index = arguments.delete(:index)
57
70
 
58
71
  method = ElasticsearchServerless::API::HTTP_PUT
59
- path = "#{Utils.listify(_index)}"
72
+ path = Utils.listify(_index).to_s
60
73
  params = Utils.process_params(arguments)
61
74
 
62
75
  ElasticsearchServerless::API::Response.new(
@@ -23,7 +23,6 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Create a data stream.
26
- # Creates a data stream.
27
26
  # You must have a matching index template with data stream enabled.
28
27
  #
29
28
  # @option arguments [String] :name Name of the data stream, which must meet the following criteria:
@@ -36,14 +35,13 @@ module ElasticsearchServerless
36
35
  # @option arguments [Time] :timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
37
36
  # @option arguments [Hash] :headers Custom HTTP headers
38
37
  #
39
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
38
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-create-data-stream
40
39
  #
41
40
  def create_data_stream(arguments = {})
42
- request_opts = { endpoint: arguments[:endpoint] || "indices.create_data_stream" }
41
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.create_data_stream' }
43
42
 
44
- defined_params = [:name].inject({}) do |set_variables, variable|
43
+ defined_params = [:name].each_with_object({}) do |variable, set_variables|
45
44
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
46
- set_variables
47
45
  end
48
46
  request_opts[:defined_params] = defined_params unless defined_params.empty?
49
47
 
@@ -23,7 +23,11 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Delete indices.
26
- # Deletes one or more indices.
26
+ # Deleting an index deletes its documents, shards, and metadata.
27
+ # It does not delete related Kibana components, such as data views, visualizations, or dashboards.
28
+ # You cannot delete the current write index of a data stream.
29
+ # To delete the index, you must roll over the data stream so a new write index is created.
30
+ # You can then use the delete index API to delete the previous write index.
27
31
  #
28
32
  # @option arguments [String, Array] :index Comma-separated list of indices to delete.
29
33
  # You cannot specify index aliases.
@@ -42,14 +46,13 @@ module ElasticsearchServerless
42
46
  # If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
43
47
  # @option arguments [Hash] :headers Custom HTTP headers
44
48
  #
45
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html
49
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete
46
50
  #
47
51
  def delete(arguments = {})
48
- request_opts = { endpoint: arguments[:endpoint] || "indices.delete" }
52
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.delete' }
49
53
 
50
- defined_params = [:index].inject({}) do |set_variables, variable|
54
+ defined_params = [:index].each_with_object({}) do |variable, set_variables|
51
55
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
52
- set_variables
53
56
  end
54
57
  request_opts[:defined_params] = defined_params unless defined_params.empty?
55
58
 
@@ -63,15 +66,15 @@ module ElasticsearchServerless
63
66
  _index = arguments.delete(:index)
64
67
 
65
68
  method = ElasticsearchServerless::API::HTTP_DELETE
66
- path = "#{Utils.listify(_index)}"
69
+ path = Utils.listify(_index).to_s
67
70
  params = Utils.process_params(arguments)
68
71
 
69
72
  if Array(arguments[:ignore]).include?(404)
70
- Utils.rescue_from_not_found {
73
+ Utils.rescue_from_not_found do
71
74
  ElasticsearchServerless::API::Response.new(
72
75
  perform_request(method, path, params, body, headers, request_opts)
73
76
  )
74
- }
77
+ end
75
78
  else
76
79
  ElasticsearchServerless::API::Response.new(
77
80
  perform_request(method, path, params, body, headers, request_opts)
@@ -35,14 +35,13 @@ module ElasticsearchServerless
35
35
  # If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
36
36
  # @option arguments [Hash] :headers Custom HTTP headers
37
37
  #
38
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html
38
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete-alias
39
39
  #
40
40
  def delete_alias(arguments = {})
41
- request_opts = { endpoint: arguments[:endpoint] || "indices.delete_alias" }
41
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_alias' }
42
42
 
43
- defined_params = [:index, :name].inject({}) do |set_variables, variable|
43
+ defined_params = [:index, :name].each_with_object({}) do |variable, set_variables|
44
44
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
45
- set_variables
46
45
  end
47
46
  request_opts[:defined_params] = defined_params unless defined_params.empty?
48
47
 
@@ -59,9 +58,7 @@ module ElasticsearchServerless
59
58
  _name = arguments.delete(:name)
60
59
 
61
60
  method = ElasticsearchServerless::API::HTTP_DELETE
62
- path = if _index && _name
63
- "#{Utils.listify(_index)}/_aliases/#{Utils.listify(_name)}"
64
- end
61
+ path = ("#{Utils.listify(_index)}/_aliases/#{Utils.listify(_name)}" if _index && _name)
65
62
  params = Utils.process_params(arguments)
66
63
 
67
64
  ElasticsearchServerless::API::Response.new(
@@ -30,14 +30,13 @@ module ElasticsearchServerless
30
30
  # @option arguments [String, Array<String>] :expand_wildcards Type of data stream that wildcard patterns can match. Supports comma-separated values,such as +open,hidden+. Server default: open.
31
31
  # @option arguments [Hash] :headers Custom HTTP headers
32
32
  #
33
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
33
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete-data-stream
34
34
  #
35
35
  def delete_data_stream(arguments = {})
36
- request_opts = { endpoint: arguments[:endpoint] || "indices.delete_data_stream" }
36
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_data_stream' }
37
37
 
38
- defined_params = [:name].inject({}) do |set_variables, variable|
38
+ defined_params = [:name].each_with_object({}) do |variable, set_variables|
39
39
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
40
- set_variables
41
40
  end
42
41
  request_opts[:defined_params] = defined_params unless defined_params.empty?
43
42
 
@@ -32,14 +32,13 @@ module ElasticsearchServerless
32
32
  # @option arguments [Time] :timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
33
33
  # @option arguments [Hash] :headers Custom HTTP headers
34
34
  #
35
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html
35
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete-index-template
36
36
  #
37
37
  def delete_index_template(arguments = {})
38
- request_opts = { endpoint: arguments[:endpoint] || "indices.delete_index_template" }
38
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_index_template' }
39
39
 
40
- defined_params = [:name].inject({}) do |set_variables, variable|
40
+ defined_params = [:name].each_with_object({}) do |variable, set_variables|
41
41
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
42
- set_variables
43
42
  end
44
43
  request_opts[:defined_params] = defined_params unless defined_params.empty?
45
44
 
@@ -23,7 +23,7 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Check indices.
26
- # Checks if one or more indices, index aliases, or data streams exist.
26
+ # Check if one or more indices, index aliases, or data streams exist.
27
27
  #
28
28
  # @option arguments [String, Array] :index Comma-separated list of data streams, indices, and aliases. Supports wildcards (+*+). (*Required*)
29
29
  # @option arguments [Boolean] :allow_no_indices If +false+, the request returns an error if any wildcard expression, index alias, or +_all+ value targets only missing or closed indices.
@@ -38,14 +38,13 @@ module ElasticsearchServerless
38
38
  # @option arguments [Boolean] :local If +true+, the request retrieves information from the local node only.
39
39
  # @option arguments [Hash] :headers Custom HTTP headers
40
40
  #
41
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html
41
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-exists
42
42
  #
43
43
  def exists(arguments = {})
44
- request_opts = { endpoint: arguments[:endpoint] || "indices.exists" }
44
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.exists' }
45
45
 
46
- defined_params = [:index].inject({}) do |set_variables, variable|
46
+ defined_params = [:index].each_with_object({}) do |variable, set_variables|
47
47
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
48
- set_variables
49
48
  end
50
49
  request_opts[:defined_params] = defined_params unless defined_params.empty?
51
50
 
@@ -59,15 +58,15 @@ module ElasticsearchServerless
59
58
  _index = arguments.delete(:index)
60
59
 
61
60
  method = ElasticsearchServerless::API::HTTP_HEAD
62
- path = "#{Utils.listify(_index)}"
61
+ path = Utils.listify(_index).to_s
63
62
  params = Utils.process_params(arguments)
64
63
 
65
64
  Utils.rescue_from_not_found do
66
- perform_request(method, path, params, body, headers, request_opts).status == 200 ? true : false
65
+ perform_request(method, path, params, body, headers, request_opts).status == 200
67
66
  end
68
67
  end
69
68
 
70
- alias_method :exists?, :exists
69
+ alias exists? exists
71
70
  end
72
71
  end
73
72
  end
@@ -23,7 +23,7 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Check aliases.
26
- # Checks if one or more data stream or index aliases exist.
26
+ # Check if one or more data stream or index aliases exist.
27
27
  #
28
28
  # @option arguments [String, Array<String>] :name Comma-separated list of aliases to check. Supports wildcards (+*+). (*Required*)
29
29
  # @option arguments [String, Array] :index Comma-separated list of data streams or indices used to limit the request. Supports wildcards (+*+).
@@ -35,17 +35,17 @@ module ElasticsearchServerless
35
35
  # Supports comma-separated values, such as +open,hidden+.
36
36
  # Valid values are: +all+, +open+, +closed+, +hidden+, +none+. Server default: open.
37
37
  # @option arguments [Boolean] :ignore_unavailable If +false+, requests that include a missing data stream or index in the target indices or data streams return an error.
38
- # @option arguments [Boolean] :local If +true+, the request retrieves information from the local node only.
38
+ # @option arguments [Time] :master_timeout Period to wait for a connection to the master node.
39
+ # If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
39
40
  # @option arguments [Hash] :headers Custom HTTP headers
40
41
  #
41
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html
42
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-exists-alias
42
43
  #
43
44
  def exists_alias(arguments = {})
44
- request_opts = { endpoint: arguments[:endpoint] || "indices.exists_alias" }
45
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.exists_alias' }
45
46
 
46
- defined_params = [:name, :index].inject({}) do |set_variables, variable|
47
+ defined_params = [:name, :index].each_with_object({}) do |variable, set_variables|
47
48
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
48
- set_variables
49
49
  end
50
50
  request_opts[:defined_params] = defined_params unless defined_params.empty?
51
51
 
@@ -69,11 +69,11 @@ module ElasticsearchServerless
69
69
  params = Utils.process_params(arguments)
70
70
 
71
71
  Utils.rescue_from_not_found do
72
- perform_request(method, path, params, body, headers, request_opts).status == 200 ? true : false
72
+ perform_request(method, path, params, body, headers, request_opts).status == 200
73
73
  end
74
74
  end
75
75
 
76
- alias_method :exists_alias?, :exists_alias
76
+ alias exists_alias? exists_alias
77
77
  end
78
78
  end
79
79
  end
@@ -22,20 +22,20 @@ module ElasticsearchServerless
22
22
  module API
23
23
  module Indices
24
24
  module Actions
25
- # Returns information about whether a particular index template exists.
25
+ # Check index templates.
26
+ # Check whether index templates exist.
26
27
  #
27
28
  # @option arguments [String] :name Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. (*Required*)
28
29
  # @option arguments [Time] :master_timeout Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s.
29
30
  # @option arguments [Hash] :headers Custom HTTP headers
30
31
  #
31
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/index-templates.html
32
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-exists-index-template
32
33
  #
33
34
  def exists_index_template(arguments = {})
34
- request_opts = { endpoint: arguments[:endpoint] || "indices.exists_index_template" }
35
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.exists_index_template' }
35
36
 
36
- defined_params = [:name].inject({}) do |set_variables, variable|
37
+ defined_params = [:name].each_with_object({}) do |variable, set_variables|
37
38
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
38
- set_variables
39
39
  end
40
40
  request_opts[:defined_params] = defined_params unless defined_params.empty?
41
41
 
@@ -57,7 +57,7 @@ module ElasticsearchServerless
57
57
  )
58
58
  end
59
59
 
60
- alias_method :exists_index_template?, :exists_index_template
60
+ alias exists_index_template? exists_index_template
61
61
  end
62
62
  end
63
63
  end
@@ -23,21 +23,20 @@ module ElasticsearchServerless
23
23
  module Indices
24
24
  module Actions
25
25
  # Get the status for a data stream lifecycle.
26
- # Retrieves information about an index or data streams current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.
26
+ # Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.
27
27
  #
28
28
  # @option arguments [String, Array] :index The name of the index to explain (*Required*)
29
29
  # @option arguments [Boolean] :include_defaults indicates if the API should return the default values the system uses for the index's lifecycle
30
30
  # @option arguments [Time] :master_timeout Specify timeout for connection to master
31
31
  # @option arguments [Hash] :headers Custom HTTP headers
32
32
  #
33
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-explain-lifecycle.html
33
+ # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-explain-data-lifecycle
34
34
  #
35
35
  def explain_data_lifecycle(arguments = {})
36
- request_opts = { endpoint: arguments[:endpoint] || "indices.explain_data_lifecycle" }
36
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.explain_data_lifecycle' }
37
37
 
38
- defined_params = [:index].inject({}) do |set_variables, variable|
38
+ defined_params = [:index].each_with_object({}) do |variable, set_variables|
39
39
  set_variables[variable] = arguments[variable] if arguments.key?(variable)
40
- set_variables
41
40
  end
42
41
  request_opts[:defined_params] = defined_params unless defined_params.empty?
43
42