From d21c8603ea98013cae35e0cf805e65560e79ef89 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Mon, 28 Jul 2025 10:34:23 +0100 Subject: [PATCH 1/3] [API] Updates source code documentation esql.async_query_get - Adds String parameter :format, a short version of the Accept header, e.g. json, yaml. Time parameters :master_timeout and :timeout have been added to the following APIs: * index_lifecycle_management ** delete_lifecycle ** get_lifecycle ** put_lifecycle ** start ** stop ** explain_lifecycle - Only :master_timeout * ingest: ** delete_geoip_database ** delete_ip_location_database ** put_geoip_database ** put_ip_location_database msearch adds new parameters: [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed) [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled *Deprecated* [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) [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) [List] :routing A comma-separated list of specific routing values [Boolean] :include_named_queries_score Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) --- .../lib/elasticsearch/api/actions/esql/async_query_get.rb | 1 + .../actions/index_lifecycle_management/delete_lifecycle.rb | 4 +++- .../actions/index_lifecycle_management/explain_lifecycle.rb | 1 + .../api/actions/index_lifecycle_management/get_lifecycle.rb | 4 +++- .../api/actions/index_lifecycle_management/put_lifecycle.rb | 4 +++- .../api/actions/index_lifecycle_management/start.rb | 4 +++- .../api/actions/index_lifecycle_management/stop.rb | 4 +++- .../api/actions/ingest/delete_geoip_database.rb | 4 +++- .../api/actions/ingest/delete_ip_location_database.rb | 4 +++- .../elasticsearch/api/actions/ingest/put_geoip_database.rb | 4 +++- .../api/actions/ingest/put_ip_location_database.rb | 4 +++- elasticsearch-api/lib/elasticsearch/api/actions/msearch.rb | 6 ++++++ 12 files changed, 35 insertions(+), 9 deletions(-) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/esql/async_query_get.rb b/elasticsearch-api/lib/elasticsearch/api/actions/esql/async_query_get.rb index 06e03e12e4..cc2ceb7249 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/esql/async_query_get.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/esql/async_query_get.rb @@ -25,6 +25,7 @@ module Actions # Retrieves the results of a previously submitted async query request given its ID. # # @option arguments [String] :id The async query ID + # @option arguments [String] :format a short version of the Accept header, e.g. json, yaml # @option arguments [Time] :wait_for_completion_timeout Specify the time that the request should block waiting for the final response # @option arguments [Time] :keep_alive Specify the time interval in which the results (partial or final) for this search will be available # @option arguments [Boolean] :drop_null_columns Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/delete_lifecycle.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/delete_lifecycle.rb index 555083b3ce..93e8677f5a 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/delete_lifecycle.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/delete_lifecycle.rb @@ -25,6 +25,8 @@ module Actions # Deletes the specified lifecycle policy definition. A currently used policy cannot be deleted. # # @option arguments [String] :policy The name of the index lifecycle policy + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-delete-lifecycle.html @@ -48,7 +50,7 @@ def delete_lifecycle(arguments = {}) method = Elasticsearch::API::HTTP_DELETE path = "_ilm/policy/#{Utils.__listify(_policy)}" - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/explain_lifecycle.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/explain_lifecycle.rb index 1a4c00f2ec..bbc0da52f4 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/explain_lifecycle.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/explain_lifecycle.rb @@ -27,6 +27,7 @@ module Actions # @option arguments [String] :index The name of the index to explain # @option arguments [Boolean] :only_managed filters the indices included in the response to ones managed by ILM # @option arguments [Boolean] :only_errors filters the indices included in the response to ones in an ILM error state, implies only_managed + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-explain-lifecycle.html diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/get_lifecycle.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/get_lifecycle.rb index 04481cf72f..385b0eb08d 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/get_lifecycle.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/get_lifecycle.rb @@ -25,6 +25,8 @@ module Actions # Returns the specified policy definition. Includes the policy version and last modified date. # # @option arguments [String] :policy The name of the index lifecycle policy + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-get-lifecycle.html @@ -50,7 +52,7 @@ def get_lifecycle(arguments = {}) else '_ilm/policy' end - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb index 38dd14ac13..f54c7a3de0 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb @@ -25,6 +25,8 @@ module Actions # Creates a lifecycle policy # # @option arguments [String] :policy The name of the index lifecycle policy + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The lifecycle policy definition to register # @@ -49,7 +51,7 @@ def put_lifecycle(arguments = {}) method = Elasticsearch::API::HTTP_PUT path = "_ilm/policy/#{Utils.__listify(_policy)}" - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/start.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/start.rb index faf1b940fd..908ff8751c 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/start.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/start.rb @@ -24,6 +24,8 @@ module IndexLifecycleManagement module Actions # Start the index lifecycle management (ILM) plugin. # + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-start.html @@ -38,7 +40,7 @@ def start(arguments = {}) method = Elasticsearch::API::HTTP_POST path = '_ilm/start' - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/stop.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/stop.rb index 5ed6f59440..1bfae4b2cc 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/stop.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index_lifecycle_management/stop.rb @@ -24,6 +24,8 @@ module IndexLifecycleManagement module Actions # Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin # + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ilm-stop.html @@ -38,7 +40,7 @@ def stop(arguments = {}) method = Elasticsearch::API::HTTP_POST path = '_ilm/stop' - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_geoip_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_geoip_database.rb index 3567c55cbf..4da80202ef 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_geoip_database.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_geoip_database.rb @@ -25,6 +25,8 @@ module Actions # Deletes a geoip database configuration # # @option arguments [List] :id A comma-separated list of geoip database configurations to delete + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-geoip-database-api.html @@ -48,7 +50,7 @@ def delete_geoip_database(arguments = {}) method = Elasticsearch::API::HTTP_DELETE path = "_ingest/geoip/database/#{Utils.__listify(_id)}" - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb index e2552e7192..3798079ebc 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/delete_ip_location_database.rb @@ -25,6 +25,8 @@ module Actions # Deletes an ip location database configuration # # @option arguments [List] :id A comma-separated list of ip location database configurations to delete + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.18/delete-ip-location-database-api.html @@ -48,7 +50,7 @@ def delete_ip_location_database(arguments = {}) method = Elasticsearch::API::HTTP_DELETE path = "_ingest/ip_location/database/#{Utils.__listify(_id)}" - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_geoip_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_geoip_database.rb index adeaafcacc..b28d4e63b6 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_geoip_database.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_geoip_database.rb @@ -25,6 +25,8 @@ module Actions # Puts the configuration for a geoip database to be downloaded # # @option arguments [String] :id The id of the database configuration + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The database configuration definition (*Required*) # @@ -50,7 +52,7 @@ def put_geoip_database(arguments = {}) method = Elasticsearch::API::HTTP_PUT path = "_ingest/geoip/database/#{Utils.__listify(_id)}" - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb index 0255f03d5c..f47c6e42e7 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/ingest/put_ip_location_database.rb @@ -25,6 +25,8 @@ module Actions # Puts the configuration for a ip location database to be downloaded # # @option arguments [String] :id The id of the database configuration + # @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node + # @option arguments [Time] :timeout Explicit operation timeout # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The database configuration definition (*Required*) # @@ -50,7 +52,7 @@ def put_ip_location_database(arguments = {}) method = Elasticsearch::API::HTTP_PUT path = "_ingest/ip_location/database/#{Utils.__listify(_id)}" - params = {} + params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/msearch.rb b/elasticsearch-api/lib/elasticsearch/api/actions/msearch.rb index 68836e3a00..673ee8968b 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/msearch.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/msearch.rb @@ -31,6 +31,12 @@ module Actions # @option arguments [Number] :max_concurrent_shard_requests The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests # @option arguments [Boolean] :rest_total_hits_as_int Indicates whether hits.total should be rendered as an integer or an object in the rest search response # @option arguments [Boolean] :ccs_minimize_roundtrips Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed) + # @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled *Deprecated* + # @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) + # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + # @option arguments [List] :routing A comma-separated list of specific routing values + # @option arguments [Boolean] :include_named_queries_score Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false) # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*) # From 8eaf584618ea4194acfa9ec66122ba009af6ec25 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Mon, 28 Jul 2025 10:35:50 +0100 Subject: [PATCH 2/3] [API] Adds inference.put_custom --- .../api/actions/inference/put_custom.rb | 65 +++++++++++++++++++ .../api/actions/inference/put_custom_spec.rb | 36 ++++++++++ 2 files changed, 101 insertions(+) create mode 100644 elasticsearch-api/lib/elasticsearch/api/actions/inference/put_custom.rb create mode 100644 elasticsearch-api/spec/elasticsearch/api/actions/inference/put_custom_spec.rb diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/inference/put_custom.rb b/elasticsearch-api/lib/elasticsearch/api/actions/inference/put_custom.rb new file mode 100644 index 0000000000..51f3435223 --- /dev/null +++ b/elasticsearch-api/lib/elasticsearch/api/actions/inference/put_custom.rb @@ -0,0 +1,65 @@ +# 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. +# +# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80 +# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec +# +module Elasticsearch + module API + module Inference + module Actions + # Configure a custom inference endpoint + # + # @option arguments [String] :task_type The task type + # @option arguments [String] :custom_inference_id The inference Id + # @option arguments [Hash] :headers Custom HTTP headers + # @option arguments [Hash] :body The inference endpoint's task and service settings + # + # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-custom + # + def put_custom(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || 'inference.put_custom' } + + defined_params = %i[task_type custom_inference_id].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 'task_type' missing" unless arguments[:task_type] + raise ArgumentError, "Required argument 'custom_inference_id' missing" unless arguments[:custom_inference_id] + + arguments = arguments.clone + headers = arguments.delete(:headers) || {} + + body = arguments.delete(:body) + + _task_type = arguments.delete(:task_type) + + _custom_inference_id = arguments.delete(:custom_inference_id) + + method = Elasticsearch::API::HTTP_PUT + path = "_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_custom_inference_id)}" + params = {} + + Elasticsearch::API::Response.new( + perform_request(method, path, params, body, headers, request_opts) + ) + end + end + end + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/put_custom_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/inference/put_custom_spec.rb new file mode 100644 index 0000000000..a409676f1b --- /dev/null +++ b/elasticsearch-api/spec/elasticsearch/api/actions/inference/put_custom_spec.rb @@ -0,0 +1,36 @@ +# 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#inference.put_custom' do + let(:expected_args) do + [ + 'PUT', + '_inference/foo/baz', + {}, + nil, + {}, + { defined_params: { custom_inference_id: 'baz', task_type: 'foo' }, + endpoint: 'inference.put_custom' } + ] + end + + it 'performs the request' do + expect(client_double.inference.put_custom(task_type: 'foo', custom_inference_id: 'baz')).to be_a Elasticsearch::API::Response + end +end From 31b2c701449a34adc062d6541b89f4d4c7b28c02 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Mon, 28 Jul 2025 10:40:54 +0100 Subject: [PATCH 3/3] Updates ingest ip specs --- .../api/actions/ingest/delete_geoip_database_spec.rb | 2 +- .../api/actions/ingest/delete_ip_location_database_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_geoip_database_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_geoip_database_spec.rb index 4a3e4e9b6e..a7a3622777 100644 --- a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_geoip_database_spec.rb +++ b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_geoip_database_spec.rb @@ -34,6 +34,6 @@ end it 'performs the request' do - expect(client_double.ingest.delete_geoip_database(id: 'foo', body: {})).to be_a Elasticsearch::API::Response + expect(client_double.ingest.delete_geoip_database(id: 'foo')).to be_a Elasticsearch::API::Response end end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb index f070341d1d..429faebe9c 100644 --- a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb +++ b/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb @@ -34,6 +34,6 @@ end it 'performs the request' do - expect(client_double.ingest.delete_ip_location_database(id: 'foo', body: {})).to be_a Elasticsearch::API::Response + expect(client_double.ingest.delete_ip_location_database(id: 'foo')).to be_a Elasticsearch::API::Response end end