From 51cceb6cc8e605ce5e0ba511b71e3b001c0d7acd Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Wed, 9 Jul 2025 16:31:53 +0100 Subject: [PATCH 1/3] [API] Adds data stream mappings endpoints --- .../indices/get_data_stream_mappings.rb | 75 +++++++++++++++++ .../indices/put_data_stream_mappings.rb | 84 +++++++++++++++++++ .../indices/get_data_stream_mappings_spec.rb | 37 ++++++++ .../indices/put_data_stream_mappings_spec.rb | 37 ++++++++ 4 files changed, 233 insertions(+) create mode 100644 elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream_mappings.rb create mode 100644 elasticsearch-api/lib/elasticsearch/api/actions/indices/put_data_stream_mappings.rb create mode 100644 elasticsearch-api/spec/unit/actions/indices/get_data_stream_mappings_spec.rb create mode 100644 elasticsearch-api/spec/unit/actions/indices/put_data_stream_mappings_spec.rb diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream_mappings.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream_mappings.rb new file mode 100644 index 0000000000..146eb00dec --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_data_stream_mappings.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 + # Get data stream mappings. + # Get mapping information for one or more data streams. + # + # @option arguments [String, Array] :name A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`). (*Required*) + # @option arguments [Time] :master_timeout The 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, Array] :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 + # `"exists_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/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-mappings + # + def get_data_stream_mappings(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'indices.get_data_stream_mappings' } + + 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)}/_mappings" + 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_mappings.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_data_stream_mappings.rb new file mode 100644 index 0000000000..eba1a3c1c6 --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_data_stream_mappings.rb @@ -0,0 +1,84 @@ +# 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 mappings. + # This API can be used to override mappings on specific data streams. These overrides will take precedence over what + # is specified in the template that the data stream matches. The mapping change is only applied to new write indices + # that are created during rollover after this API is called. No indices are changed by this API. + # + # @option arguments [String, Array] :name A comma-separated list of data streams or data stream patterns. (*Required*) + # @option arguments [Boolean] :dry_run If `true`, the request does not actually change the mappings on any data streams. Instead, it + # simulates changing the settings and reports back to the user what would have happened had these settings + # actually been applied. + # @option arguments [Time] :master_timeout The 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 The 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, Array] :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 + # `"exists_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 mappings + # + # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-mappings + # + def put_data_stream_mappings(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'indices.put_data_stream_mappings' } + + 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 'body' missing" unless arguments[:body] + 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)}/_mappings" + 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/spec/unit/actions/indices/get_data_stream_mappings_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_data_stream_mappings_spec.rb new file mode 100644 index 0000000000..acd3f5fca7 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/get_data_stream_mappings_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_mappings' do + let(:expected_args) do + [ + 'GET', + '_data_stream/foo/_mappings', + {}, + nil, + {}, + { endpoint: 'indices.get_data_stream_mappings', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.get_data_stream_mappings(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/indices/put_data_stream_mappings_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_data_stream_mappings_spec.rb new file mode 100644 index 0000000000..2da78f6f7f --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/put_data_stream_mappings_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.put_data_stream_mappings' do + let(:expected_args) do + [ + 'PUT', + '_data_stream/foo/_mappings', + {}, + {}, + {}, + { endpoint: 'indices.put_data_stream_mappings', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.put_data_stream_mappings(name: 'foo', body: {})).to be_a Elasticsearch::API::Response + end +end From 4c2a1a1f76f5a2a4ab7f7605505938d69d21c2c9 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Wed, 9 Jul 2025 16:32:09 +0100 Subject: [PATCH 2/3] [API] Updates test names in indices --- elasticsearch-api/spec/unit/actions/indices/forcemerge_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/get_alias_spec.rb | 2 +- .../spec/unit/actions/indices/get_field_mapping_spec.rb | 3 +-- .../spec/unit/actions/indices/get_mapping_spec.rb | 2 +- .../spec/unit/actions/indices/get_settings_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/put_alias_spec.rb | 2 +- .../spec/unit/actions/indices/put_data_stream_options_spec.rb | 2 +- .../spec/unit/actions/indices/put_data_stream_settings_spec.rb | 2 +- .../spec/unit/actions/indices/put_mapping_spec.rb | 2 +- .../spec/unit/actions/indices/put_settings_spec.rb | 2 +- .../spec/unit/actions/indices/put_template_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/recovery_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/refresh_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/rollover_spec.rb | 3 +-- elasticsearch-api/spec/unit/actions/indices/segments_spec.rb | 2 +- .../spec/unit/actions/indices/shard_stores_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/shrink_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/split_spec.rb | 2 +- elasticsearch-api/spec/unit/actions/indices/stats_spec.rb | 2 +- .../spec/unit/actions/indices/update_aliases_spec.rb | 2 +- .../spec/unit/actions/indices/validate_query_spec.rb | 2 +- 21 files changed, 21 insertions(+), 23 deletions(-) diff --git a/elasticsearch-api/spec/unit/actions/indices/forcemerge_spec.rb b/elasticsearch-api/spec/unit/actions/indices/forcemerge_spec.rb index e64284e9b4..3008336c26 100644 --- a/elasticsearch-api/spec/unit/actions/indices/forcemerge_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/forcemerge_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#forcemerge' do +describe 'client.indices#forcemerge' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/get_alias_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_alias_spec.rb index b1000df66f..891c4ff73b 100644 --- a/elasticsearch-api/spec/unit/actions/indices/get_alias_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/get_alias_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#get_alias' do +describe 'client.indices#get_alias' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/get_field_mapping_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_field_mapping_spec.rb index e9550b65e9..a77d5d5a08 100644 --- a/elasticsearch-api/spec/unit/actions/indices/get_field_mapping_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/get_field_mapping_spec.rb @@ -17,8 +17,7 @@ require 'spec_helper' -describe 'client.cluster#get_field_mapping' do - +describe 'client.indices#get_field_mapping' do let(:expected_args) do [ 'GET', diff --git a/elasticsearch-api/spec/unit/actions/indices/get_mapping_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_mapping_spec.rb index 5a6f018d9d..425442549a 100644 --- a/elasticsearch-api/spec/unit/actions/indices/get_mapping_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/get_mapping_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#get_mapping' do +describe 'client.indices#get_mapping' do let(:expected_args) do [ 'GET', diff --git a/elasticsearch-api/spec/unit/actions/indices/get_settings_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_settings_spec.rb index 9d6bb92f22..1b9ffc1cfb 100644 --- a/elasticsearch-api/spec/unit/actions/indices/get_settings_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/get_settings_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#get_settings' do +describe 'client.indices#get_settings' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/put_alias_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_alias_spec.rb index 12a1f71dd2..a62ce30e6c 100644 --- a/elasticsearch-api/spec/unit/actions/indices/put_alias_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/put_alias_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#put_alias' do +describe 'client.indices#put_alias' do let(:expected_args) do [ 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 index 61e3445470..427e76fba5 100644 --- 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 @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#put_data_stream_options' do +describe 'client.indices#put_data_stream_options' do let(:expected_args) do [ 'PUT', diff --git a/elasticsearch-api/spec/unit/actions/indices/put_data_stream_settings_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_data_stream_settings_spec.rb index 9d0990ae59..cfcd169e01 100644 --- a/elasticsearch-api/spec/unit/actions/indices/put_data_stream_settings_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/put_data_stream_settings_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#put_data_stream_settings' do +describe 'client.indices#put_data_stream_settings' do let(:expected_args) do [ 'PUT', diff --git a/elasticsearch-api/spec/unit/actions/indices/put_mapping_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_mapping_spec.rb index ddce002359..400fc2776e 100644 --- a/elasticsearch-api/spec/unit/actions/indices/put_mapping_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/put_mapping_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#put_mapping' do +describe 'client.indices#put_mapping' do let(:expected_args) do [ 'PUT', diff --git a/elasticsearch-api/spec/unit/actions/indices/put_settings_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_settings_spec.rb index ef4009bc6e..4a340537f6 100644 --- a/elasticsearch-api/spec/unit/actions/indices/put_settings_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/put_settings_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#put_settings' do +describe 'client.indices#put_settings' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/put_template_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_template_spec.rb index a076da4e93..0179fa0db3 100644 --- a/elasticsearch-api/spec/unit/actions/indices/put_template_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/put_template_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#put_template' do +describe 'client.indices#put_template' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/recovery_spec.rb b/elasticsearch-api/spec/unit/actions/indices/recovery_spec.rb index cc9605dd43..dc698834b6 100644 --- a/elasticsearch-api/spec/unit/actions/indices/recovery_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/recovery_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#recovery' do +describe 'client.indices#recovery' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/refresh_spec.rb b/elasticsearch-api/spec/unit/actions/indices/refresh_spec.rb index 970cda977d..39fc552532 100644 --- a/elasticsearch-api/spec/unit/actions/indices/refresh_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/refresh_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#refresh' do +describe 'client.indices#refresh' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/rollover_spec.rb b/elasticsearch-api/spec/unit/actions/indices/rollover_spec.rb index 67a748a257..59a32a09de 100644 --- a/elasticsearch-api/spec/unit/actions/indices/rollover_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/rollover_spec.rb @@ -17,8 +17,7 @@ require 'spec_helper' -describe 'client.cluster#rollover' do - +describe 'client.indices#rollover' do let(:expected_args) do [ 'POST', diff --git a/elasticsearch-api/spec/unit/actions/indices/segments_spec.rb b/elasticsearch-api/spec/unit/actions/indices/segments_spec.rb index aa2001b95d..2505b4fb5c 100644 --- a/elasticsearch-api/spec/unit/actions/indices/segments_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/segments_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#segments' do +describe 'client.indices#segments' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/shard_stores_spec.rb b/elasticsearch-api/spec/unit/actions/indices/shard_stores_spec.rb index 82a0eccda3..5be566ef96 100644 --- a/elasticsearch-api/spec/unit/actions/indices/shard_stores_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/shard_stores_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#shard_stores' do +describe 'client.indices#shard_stores' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/shrink_spec.rb b/elasticsearch-api/spec/unit/actions/indices/shrink_spec.rb index 73e2682716..519754714f 100644 --- a/elasticsearch-api/spec/unit/actions/indices/shrink_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/shrink_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#shrink' do +describe 'client.indices#shrink' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/split_spec.rb b/elasticsearch-api/spec/unit/actions/indices/split_spec.rb index ba08085bdd..a90d749b41 100644 --- a/elasticsearch-api/spec/unit/actions/indices/split_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/split_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#split' do +describe 'client.indices#split' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/stats_spec.rb b/elasticsearch-api/spec/unit/actions/indices/stats_spec.rb index 91b0ed7bb2..c90e89bb44 100644 --- a/elasticsearch-api/spec/unit/actions/indices/stats_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/stats_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#stats' do +describe 'client.indices#stats' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/update_aliases_spec.rb b/elasticsearch-api/spec/unit/actions/indices/update_aliases_spec.rb index 0d18ca537a..e237456e8e 100644 --- a/elasticsearch-api/spec/unit/actions/indices/update_aliases_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/update_aliases_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#update_aliases' do +describe 'client.indices#update_aliases' do let(:expected_args) do [ diff --git a/elasticsearch-api/spec/unit/actions/indices/validate_query_spec.rb b/elasticsearch-api/spec/unit/actions/indices/validate_query_spec.rb index 2aeb027e36..b6059ed253 100644 --- a/elasticsearch-api/spec/unit/actions/indices/validate_query_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/validate_query_spec.rb @@ -17,7 +17,7 @@ require 'spec_helper' -describe 'client.cluster#validate_query' do +describe 'client.indices#validate_query' do let(:expected_args) do [ method, From 799eef0b7f30f822ef43df9302dc045def703a72 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Wed, 9 Jul 2025 16:37:49 +0100 Subject: [PATCH 3/3] [API] Updates source code to commit dc3690c592d7b3d1c8d238119e4fac01c6f91c90. Changes: * cluster.get_component_template - Adds [String] `:settings_filter` Filter out results, for example to filter out sensitive information. Supports wildcards or full settings keys. * cluster.put_component_template - Adds [String] `:cause` User defined reason for create the component template. Server default: api. * get, search - Add [Boolean] `:_source_exclude_vectors` Whether vectors should be excluded from _source, get_source - removes stored_fields parameter * index - Adds [Boolean] `:require_data_stream` If `true`, the request's actions must target a data stream (existing or to be created). * license.post_start_trial - [String] `type_query_string` parameter renamed to `type`, The type of trial license to generate (default: "trial") --- .../elasticsearch/api/actions/cat/shards.rb | 6 ++-- .../api/actions/cat/thread_pool.rb | 4 +-- .../actions/cluster/get_component_template.rb | 1 + .../actions/cluster/put_component_template.rb | 1 + .../lib/elasticsearch/api/actions/get.rb | 1 + .../elasticsearch/api/actions/get_source.rb | 1 - .../lib/elasticsearch/api/actions/index.rb | 1 + .../api/actions/inference/rerank.rb | 2 +- .../ingest/get_ip_location_database.rb | 3 -- .../api/actions/license/post_start_trial.rb | 2 +- .../lib/elasticsearch/api/actions/search.rb | 1 + .../api/actions/synonyms/put_synonym.rb | 1 + .../lib/elasticsearch/api/actions/update.rb | 1 + .../api/actions/update_by_query.rb | 30 ++++++++++++------- .../lib/elasticsearch/api/version.rb | 2 +- 15 files changed, 34 insertions(+), 23 deletions(-) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/cat/shards.rb b/elasticsearch-api/lib/elasticsearch/api/actions/cat/shards.rb index fd96233ec1..c040372628 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/cat/shards.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/cat/shards.rb @@ -32,11 +32,11 @@ module Actions # To target all data streams and indices, omit this parameter or use `*` or `_all`. # @option arguments [String] :bytes The unit used to display byte values. # @option arguments [String, Array] :h List of columns to appear in the response. Supports simple wildcards. - # @option arguments [String, Array] :s List of columns that determine how the table should be sorted. + # @option arguments [String, Array] :s A comma-separated list of column names or aliases that determines the sort order. # Sorting defaults to ascending and can be changed by setting `:asc` # or `:desc` as a suffix to the column name. - # @option arguments [Time] :master_timeout Period to wait for a connection to the master node. Server default: 30s. - # @option arguments [String] :time Unit used to display time values. + # @option arguments [Time] :master_timeout The period to wait for a connection to the master node. Server default: 30s. + # @option arguments [String] :time The unit used to display time values. # @option arguments [String] :format Specifies the format to return the columnar data in, can be set to # `text`, `json`, `cbor`, `yaml`, or `smile`. Server default: text. # @option arguments [Boolean] :help When set to `true` will output available columns. This option diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/cat/thread_pool.rb b/elasticsearch-api/lib/elasticsearch/api/actions/cat/thread_pool.rb index 505b1c5257..fd934c3c34 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/cat/thread_pool.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/cat/thread_pool.rb @@ -30,7 +30,7 @@ module Actions # @option arguments [String, Array] :thread_pool_patterns A comma-separated list of thread pool names used to limit the request. # Accepts wildcard expressions. # @option arguments [String, Array] :h List of columns to appear in the response. Supports simple wildcards. - # @option arguments [String, Array] :s List of columns that determine how the table should be sorted. + # @option arguments [String, Array] :s A comma-separated list of column names or aliases that determines the sort order. # Sorting defaults to ascending and can be changed by setting `:asc` # or `:desc` as a suffix to the column name. # @option arguments [String] :time The unit used to display time values. @@ -38,7 +38,7 @@ module Actions # local cluster state. If `false` the list of selected nodes are computed # from the cluster state of the master node. In both cases the coordinating # node will send requests for further information to each selected node. - # @option arguments [Time] :master_timeout Period to wait for a connection to the master node. Server default: 30s. + # @option arguments [Time] :master_timeout The period to wait for a connection to the master node. Server default: 30s. # @option arguments [String] :format Specifies the format to return the columnar data in, can be set to # `text`, `json`, `cbor`, `yaml`, or `smile`. Server default: text. # @option arguments [Boolean] :help When set to `true` will output available columns. This option diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/cluster/get_component_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/cluster/get_component_template.rb index b1f17237bb..96d74d81ea 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/cluster/get_component_template.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/cluster/get_component_template.rb @@ -28,6 +28,7 @@ module Actions # @option arguments [String] :name Comma-separated list of component template names used to limit the request. # Wildcard (`*`) expressions are supported. # @option arguments [Boolean] :flat_settings If `true`, returns settings in flat format. + # @option arguments [String, Array] :settings_filter Filter out results, for example to filter out sensitive information. Supports wildcards or full settings keys # @option arguments [Boolean] :include_defaults Return all default configurations for the component template (default: false) # @option arguments [Boolean] :local If `true`, the request retrieves information from the local node only. # If `false`, information is retrieved from the master node. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/cluster/put_component_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/cluster/put_component_template.rb index 5b1d9d2ac6..4ef90fcdf6 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/cluster/put_component_template.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/cluster/put_component_template.rb @@ -43,6 +43,7 @@ module Actions # If you use Elastic Agent and want to overwrite one of these templates, set the `version` for your replacement template higher than the current version. # If you don’t use Elastic Agent and want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the cluster update settings API. (*Required*) # @option arguments [Boolean] :create If `true`, this request cannot replace or update existing component templates. + # @option arguments [String] :cause User defined reason for create the component template. Server default: api. # @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 diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/get.rb b/elasticsearch-api/lib/elasticsearch/api/actions/get.rb index f56db4357d..753cf71525 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/get.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/get.rb @@ -88,6 +88,7 @@ module Actions # @option arguments [String, Array] :_source_excludes A comma-separated list of source fields to exclude from the response. # You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. # If the `_source` parameter is `false`, this parameter is ignored. + # @option arguments [Boolean] :_source_exclude_vectors Whether vectors should be excluded from _source # @option arguments [String, Array] :_source_includes A comma-separated list of source fields to include in the response. # If this parameter is specified, only these source fields are returned. # You can exclude fields from this subset using the `_source_excludes` query parameter. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/get_source.rb b/elasticsearch-api/lib/elasticsearch/api/actions/get_source.rb index 09ff866242..92c76cdc1f 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/get_source.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/get_source.rb @@ -46,7 +46,6 @@ module Actions # @option arguments [Boolean, String, Array] :_source Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. # @option arguments [String, Array] :_source_excludes A comma-separated list of source fields to exclude in the response. # @option arguments [String, Array] :_source_includes A comma-separated list of source fields to include in the response. - # @option arguments [String, Array] :stored_fields A comma-separated list of stored fields to return as part of a hit. # @option arguments [Integer] :version The version number for concurrency control. # It must match the current version of the document for the request to succeed. # @option arguments [String] :version_type The version type. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index.rb index 5f9609c74e..ae585903bc 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index.rb @@ -138,6 +138,7 @@ module Actions # You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). # The default value of `1` means it waits for each primary shard to be active. Server default: 1. # @option arguments [Boolean] :require_alias If `true`, the destination must be an index alias. + # @option arguments [Boolean] :require_data_stream If `true`, the request's actions must target a data stream (existing or to be created). # @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors # when they occur. # @option arguments [String, Array] :filter_path Comma-separated list of filters in dot notation which reduce the response diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/inference/rerank.rb b/elasticsearch-api/lib/elasticsearch/api/actions/inference/rerank.rb index b462a30dd1..8f65a97c47 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/inference/rerank.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/inference/rerank.rb @@ -22,7 +22,7 @@ module Elasticsearch module API module Inference module Actions - # Perform rereanking inference on the service + # Perform reranking inference on the service # # @option arguments [String] :inference_id The unique identifier for the inference endpoint. (*Required*) # @option arguments [Time] :timeout The amount of time to wait for the inference request to complete. Server default: 30s. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb index 76efbcc081..c753cbbcdc 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/get_ip_location_database.rb @@ -27,9 +27,6 @@ module Actions # @option arguments [String, Array] :id Comma-separated list of database configuration IDs to retrieve. # Wildcard (`*`) expressions are supported. # To get all database configurations, omit this parameter or use `*`. - # @option arguments [Time] :master_timeout The 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. - # A value of `-1` indicates that the request should never time out. 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, Array] :filter_path Comma-separated list of filters in dot notation which reduce the response diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/license/post_start_trial.rb b/elasticsearch-api/lib/elasticsearch/api/actions/license/post_start_trial.rb index bd4a8cd7dc..594af810a8 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/license/post_start_trial.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/license/post_start_trial.rb @@ -29,7 +29,7 @@ module Actions # To check the status of your trial, use the get trial status API. # # @option arguments [Boolean] :acknowledge whether the user has acknowledged acknowledge messages (default: false) - # @option arguments [String] :type_query_string [TODO] + # @option arguments [String] :type The type of trial license to generate (default: "trial") # @option arguments [Time] :master_timeout Period to wait for a connection to the master node. Server default: 30s. # @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors # when they occur. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/search.rb b/elasticsearch-api/lib/elasticsearch/api/actions/search.rb index a1f2a03374..eec96bb2ea 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/search.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/search.rb @@ -129,6 +129,7 @@ module Actions # @option arguments [String, Array] :_source_excludes A comma-separated list of source fields to exclude from the response. # You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. # If the `_source` parameter is `false`, this parameter is ignored. + # @option arguments [Boolean] :_source_exclude_vectors Whether vectors should be excluded from _source # @option arguments [String, Array] :_source_includes A comma-separated list of source fields to include in the response. # If this parameter is specified, only these source fields are returned. # You can exclude fields from this subset using the `_source_excludes` query parameter. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/synonyms/put_synonym.rb b/elasticsearch-api/lib/elasticsearch/api/actions/synonyms/put_synonym.rb index 37359216c0..96ddd48175 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/synonyms/put_synonym.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/synonyms/put_synonym.rb @@ -27,6 +27,7 @@ module Actions # If you need to manage more synonym rules, you can create multiple synonym sets. # When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. # This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set. + # For practical examples of how to create or update a synonyms set, refer to the External documentation. # # @option arguments [String] :id The ID of the synonyms set to be created or updated. (*Required*) # @option arguments [Boolean] :refresh If `true`, the request will refresh the analyzers with the new synonyms set and wait for the new synonyms to be available before returning. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/update.rb b/elasticsearch-api/lib/elasticsearch/api/actions/update.rb index fadd2e549a..979f4437cf 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/update.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/update.rb @@ -34,6 +34,7 @@ module Actions # The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation. # The `_source` field must be enabled to use this API. # In addition to `_source`, you can access the following variables through the `ctx` map: `_index`, `_type`, `_id`, `_version`, `_routing`, and `_now` (the current timestamp). + # For usage examples such as partial updates, upserts, and scripted updates, see the External documentation. # # @option arguments [String] :id A unique identifier for the document to be updated. (*Required*) # @option arguments [String] :index The name of the target index. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/update_by_query.rb b/elasticsearch-api/lib/elasticsearch/api/actions/update_by_query.rb index b706ce947c..b612b2a62a 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/update_by_query.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/update_by_query.rb @@ -38,6 +38,24 @@ module Actions # A bulk update request is performed for each batch of matching documents. # Any query or update failures cause the update by query request to fail and the failures are shown in the response. # Any update requests that completed successfully still stick, they are not rolled back. + # **Refreshing shards** + # Specifying the `refresh` parameter refreshes all shards once the request completes. + # This is different to the update API's `refresh` parameter, which causes only the shard + # that received the request to be refreshed. Unlike the update API, it does not support + # `wait_for`. + # **Running update by query asynchronously** + # If the request contains `wait_for_completion=false`, Elasticsearch + # performs some preflight checks, launches the request, and returns a + # {https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks task} you can use to cancel or get the status of the task. + # Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. + # **Waiting for active shards** + # `wait_for_active_shards` controls how many copies of a shard must be active + # before proceeding with the request. See {https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-create#operation-create-wait_for_active_shards `wait_for_active_shards`} + # for details. `timeout` controls how long each write request waits for unavailable + # shards to become available. Both work exactly the way they work in the + # {https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk Bulk API}. Update by query uses scrolled searches, so you can also + # specify the `scroll` parameter to control how long it keeps the search context + # alive, for example `?scroll=10m`. The default is 5 minutes. # **Throttling update requests** # To control the rate at which update by query issues batches of update operations, you can set `requests_per_second` to any positive decimal number. # This pads each batch with a wait time to throttle the rate. @@ -72,17 +90,7 @@ module Actions # * Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead. # * Update performance scales linearly across available resources with the number of slices. # Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources. - # **Update the document source** - # Update by query supports scripts to update the document source. - # As with the update API, you can set `ctx.op` to change the operation that is performed. - # Set `ctx.op = "noop"` if your script decides that it doesn't have to make any changes. - # The update by query operation skips updating the document and increments the `noop` counter. - # Set `ctx.op = "delete"` if your script decides that the document should be deleted. - # The update by query operation deletes the document and increments the `deleted` counter. - # Update by query supports only `index`, `noop`, and `delete`. - # Setting `ctx.op` to anything else is an error. - # Setting any other field in `ctx` is an error. - # This API enables you to only modify the source of matching documents; you cannot move them. + # Refer to the linked documentation for examples of how to update documents using the `_update_by_query` API: # # @option arguments [String, Array] :index A comma-separated list of data streams, indices, and aliases to search. # It supports wildcards (`*`). diff --git a/elasticsearch-api/lib/elasticsearch/api/version.rb b/elasticsearch-api/lib/elasticsearch/api/version.rb index 15a5c3826b..a3a7c5b40b 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.1.0'.freeze - ES_SPECIFICATION_COMMIT = '58fbe0ad87bb94a0870b7df4db76587fbfcaa5b7'.freeze + ES_SPECIFICATION_COMMIT = 'dc3690c592d7b3d1c8d238119e4fac01c6f91c90'.freeze end end