diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_data_stream_options.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_data_stream_options.rb new file mode 100644 index 0000000000..a82cc989a8 --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_data_stream_options.rb @@ -0,0 +1,75 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# This code was automatically generated from the Elasticsearch Specification +# See https://github.com/elastic/elasticsearch-specification +# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash. +module Elasticsearch + module API + module Indices + module Actions + # Delete data stream options. + # Removes the data stream options from a data stream. + # + # @option arguments [String, Array] :name A comma-separated list of data streams of which the data stream options will be deleted; use `*` to get all data streams (*Required*) + # @option arguments [String, Array] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open) + # @option arguments [Time] :master_timeout Specify timeout for connection to master + # @option arguments [Time] :timeout Explicit timestamp for the document + # @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors + # when they occur. + # @option arguments [String] :filter_path Comma-separated list of filters in dot notation which reduce the response + # returned by Elasticsearch. + # @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans. + # For example `"exists_time": "1h"` for humans and + # `"eixsts_time_in_millis": 3600000` for computers. When disabled the human + # readable values will be omitted. This makes sense for responses being consumed + # only by machines. + # @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use + # this option for debugging only. + # @option arguments [Hash] :headers Custom HTTP headers + # + # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html + # + def delete_data_stream_options(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'indices.delete_data_stream_options' } + + defined_params = [:name].each_with_object({}) do |variable, set_variables| + set_variables[variable] = arguments[variable] if arguments.key?(variable) + end + request_opts[:defined_params] = defined_params unless defined_params.empty? + + raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] + + arguments = arguments.clone + headers = arguments.delete(:headers) || {} + + body = nil + + _name = arguments.delete(:name) + + method = Elasticsearch::API::HTTP_DELETE + path = "_data_stream/#{Utils.listify(_name)}/_options" + params = Utils.process_params(arguments) + + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + end + end + end +end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream_options.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream_options.rb new file mode 100644 index 0000000000..5375eeeff8 --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream_options.rb @@ -0,0 +1,78 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# This code was automatically generated from the Elasticsearch Specification +# See https://github.com/elastic/elasticsearch-specification +# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash. +module Elasticsearch + module API + module Indices + module Actions + # Get data stream options. + # Get the data stream options configuration of one or more data streams. + # + # @option arguments [String, Array] :name Comma-separated list of data streams to limit the request. + # Supports wildcards (`*`). + # To target all data streams, omit this parameter or use `*` or `_all`. (*Required*) + # @option arguments [String, Array] :expand_wildcards Type of data stream that wildcard patterns can match. + # Supports comma-separated values, such as `open,hidden`. + # Valid values are: `all`, `open`, `closed`, `hidden`, `none`. Server default: open. + # @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. + # @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors + # when they occur. + # @option arguments [String] :filter_path Comma-separated list of filters in dot notation which reduce the response + # returned by Elasticsearch. + # @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans. + # For example `"exists_time": "1h"` for humans and + # `"eixsts_time_in_millis": 3600000` for computers. When disabled the human + # readable values will be omitted. This makes sense for responses being consumed + # only by machines. + # @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use + # this option for debugging only. + # @option arguments [Hash] :headers Custom HTTP headers + # + # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html + # + def get_data_stream_options(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'indices.get_data_stream_options' } + + defined_params = [:name].each_with_object({}) do |variable, set_variables| + set_variables[variable] = arguments[variable] if arguments.key?(variable) + end + request_opts[:defined_params] = defined_params unless defined_params.empty? + + raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] + + arguments = arguments.clone + headers = arguments.delete(:headers) || {} + + body = nil + + _name = arguments.delete(:name) + + method = Elasticsearch::API::HTTP_GET + path = "_data_stream/#{Utils.listify(_name)}/_options" + params = Utils.process_params(arguments) + + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + end + end + end +end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_data_stream_options.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_data_stream_options.rb new file mode 100644 index 0000000000..5e5d476810 --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_data_stream_options.rb @@ -0,0 +1,83 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# This code was automatically generated from the Elasticsearch Specification +# See https://github.com/elastic/elasticsearch-specification +# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash. +module Elasticsearch + module API + module Indices + module Actions + # Update data stream options. + # Update the data stream options of the specified data streams. + # + # @option arguments [String, Array] :name Comma-separated list of data streams used to limit the request. + # Supports wildcards (`*`). + # To target all data streams use `*` or `_all`. (*Required*) + # @option arguments [String, Array] :expand_wildcards Type of data stream that wildcard patterns can match. + # Supports comma-separated values, such as `open,hidden`. + # Valid values are: `all`, `hidden`, `open`, `closed`, `none`. Server default: open. + # @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. + # @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. + # @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors + # when they occur. + # @option arguments [String] :filter_path Comma-separated list of filters in dot notation which reduce the response + # returned by Elasticsearch. + # @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans. + # For example `"exists_time": "1h"` for humans and + # `"eixsts_time_in_millis": 3600000` for computers. When disabled the human + # readable values will be omitted. This makes sense for responses being consumed + # only by machines. + # @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use + # this option for debugging only. + # @option arguments [Hash] :headers Custom HTTP headers + # @option arguments [Hash] :body request body + # + # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html + # + def put_data_stream_options(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'indices.put_data_stream_options' } + + defined_params = [:name].each_with_object({}) do |variable, set_variables| + set_variables[variable] = arguments[variable] if arguments.key?(variable) + end + request_opts[:defined_params] = defined_params unless defined_params.empty? + + raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] + + arguments = arguments.clone + headers = arguments.delete(:headers) || {} + + body = arguments.delete(:body) + + _name = arguments.delete(:name) + + method = Elasticsearch::API::HTTP_PUT + path = "_data_stream/#{Utils.listify(_name)}/_options" + params = Utils.process_params(arguments) + + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + end + end + end +end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_settings.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_settings.rb index f2e1258377..681e29b5b3 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_settings.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_settings.rb @@ -26,8 +26,46 @@ module Actions # Changes dynamic index settings in real time. # For data streams, index setting changes are applied to all backing indices by default. # To revert a setting to the default value, use a null value. - # The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. + # The list of per-index settings that can be updated dynamically on live indices can be found in index settings documentation. # To preserve existing settings from being updated, set the `preserve_existing` parameter to `true`. + # There are multiple valid ways to represent index settings in the request body. You can specify only the setting, for example: + # + # ``` + # { + # "number_of_replicas": 1 + # } + # ``` + # + # Or you can use an `index` setting object: + # + # ``` + # { + # "index": { + # "number_of_replicas": 1 + # } + # } + # ``` + # + # Or you can use dot annotation: + # + # ``` + # { + # "index.number_of_replicas": 1 + # } + # ``` + # + # Or you can embed any of the aforementioned options in a `settings` object. For example: + # + # ``` + # { + # "settings": { + # "index": { + # "number_of_replicas": 1 + # } + # } + # } + # ``` + # # NOTE: You can only define new analyzers on closed indices. # To add an analyzer, you must close the index, define the analyzer, and reopen the index. # You cannot close the write index of a data stream. diff --git a/elasticsearch-api/lib/elasticsearch/api/version.rb b/elasticsearch-api/lib/elasticsearch/api/version.rb index ad8bffa42e..bb4120afd4 100644 --- a/elasticsearch-api/lib/elasticsearch/api/version.rb +++ b/elasticsearch-api/lib/elasticsearch/api/version.rb @@ -18,6 +18,6 @@ module Elasticsearch module API VERSION = '9.0.0'.freeze - ES_SPECIFICATION_COMMIT = 'f15ccea832ee9dba2b1a31f6d7430940c2a53984'.freeze + ES_SPECIFICATION_COMMIT = '00be10ac5ace4211ff41c0c640eb9b6ecaf10f07'.freeze end end diff --git a/elasticsearch-api/spec/unit/actions/indices/delete_data_stream_options_spec.rb b/elasticsearch-api/spec/unit/actions/indices/delete_data_stream_options_spec.rb new file mode 100644 index 0000000000..74c67902e7 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/delete_data_stream_options_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.delete_data_stream_options' do + let(:expected_args) do + [ + 'DELETE', + '_data_stream/foo/_options', + {}, + nil, + {}, + { endpoint: 'indices.delete_data_stream_options', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.delete_data_stream_options(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/indices/get_data_stream_options_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_data_stream_options_spec.rb new file mode 100644 index 0000000000..ce5d08ea4b --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/get_data_stream_options_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.get_data_stream_options' do + let(:expected_args) do + [ + 'GET', + '_data_stream/foo/_options', + {}, + nil, + {}, + { endpoint: 'indices.get_data_stream_options', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.get_data_stream_options(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/indices/put_data_stream_options_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_data_stream_options_spec.rb new file mode 100644 index 0000000000..61e3445470 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/put_data_stream_options_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.cluster#put_data_stream_options' do + let(:expected_args) do + [ + 'PUT', + '_data_stream/foo/_options', + {}, + nil, + {}, + { endpoint: 'indices.put_data_stream_options', defined_params: { name: 'foo' } } + ] + end + + it 'performs the request' do + expect(client_double.indices.put_data_stream_options(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/perform_request_spec.rb b/elasticsearch-api/spec/unit/perform_request_spec.rb index 6d58d3785a..8f75ea482b 100644 --- a/elasticsearch-api/spec/unit/perform_request_spec.rb +++ b/elasticsearch-api/spec/unit/perform_request_spec.rb @@ -28,8 +28,8 @@ # TODO: Once the test suite is migrated to elasticsearch-specification, these should be removed spec.module_namespace.flatten.first == 'rollup' || [ - 'scroll', 'clear_scroll', 'connector.last_sync', 'inference.put_eis', 'knn_search', - 'indices.put_data_stream_options', 'indices.delete_data_stream_options', 'indices.get_data_stream_options' + 'scroll', 'clear_scroll', 'connector.last_sync', 'knn_search', + 'indices.put_data_stream_settings', 'indices.get_data_stream_settings' ].include?(spec.endpoint_name) # These are the path parts defined by the user in the method argument