diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb b/elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb index 099be60890..b7440df9b5 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb @@ -36,6 +36,7 @@ module Actions # @option arguments [Boolean] :require_alias Sets require_alias for all incoming documents. Defaults to unset (false) # @option arguments [Boolean] :require_data_stream When true, requires the destination to be a data stream (existing or to-be-created). Default is false # @option arguments [Boolean] :list_executed_pipelines Sets list_executed_pipelines for all incoming documents. Defaults to unset (false) + # @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. Defaults to true. # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [String|Array] :body The operation definition and data (action-data pairs), separated by newlines. Array of Strings, Header/Data pairs, # or the conveniency "combined" format can be passed, refer to Elasticsearch::API::Utils.__bulkify documentation. diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/create.rb b/elasticsearch-api/lib/elasticsearch/api/actions/create.rb index 52c47b68ae..229eeb56ca 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/create.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/create.rb @@ -34,6 +34,7 @@ module Actions # @option arguments [Number] :version Explicit version number for concurrency control # @option arguments [String] :version_type Specific version type (options: internal, external, external_gte) # @option arguments [String] :pipeline The pipeline id to preprocess incoming documents with + # @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. Defaults to true. # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The document (*Required*) # diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/index.rb b/elasticsearch-api/lib/elasticsearch/api/actions/index.rb index cbaece1ed1..be0f440e87 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/index.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/index.rb @@ -37,6 +37,7 @@ module Actions # @option arguments [String] :pipeline The pipeline id to preprocess incoming documents with # @option arguments [Boolean] :require_alias When true, requires destination to be an alias. Default is false # @option arguments [Boolean] :require_data_stream When true, requires the destination to be a data stream (existing or to-be-created). Default is false + # @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. Defaults to true. # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The document (*Required*) # diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/resolve_cluster.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/resolve_cluster.rb index 1f6859af63..67c668de46 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/resolve_cluster.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/resolve_cluster.rb @@ -22,13 +22,14 @@ module Elasticsearch module API module Indices module Actions - # Resolves the specified index expressions to return information about each cluster, including the local cluster, if included. + # Resolves the specified index expressions to return information about each cluster. If no index expression is provided, this endpoint will return information about all the remote clusters that are configured on the local cluster. # # @option arguments [List] :name A comma-separated list of cluster:index names or wildcard expressions - # @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 - # @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 wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all) + # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed). Only allowed when providing an index expression. + # @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled. Only allowed when providing an index expression. + # @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). Only allowed when providing an index expression. + # @option arguments [String] :expand_wildcards Whether wildcard expressions should get expanded to open or closed indices (default: open). Only allowed when providing an index expression. (options: open, closed, hidden, none, all) + # @option arguments [Time] :timeout The maximum time to wait for remote clusters to respond # @option arguments [Hash] :headers Custom HTTP headers # # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.17/indices-resolve-cluster-api.html @@ -41,8 +42,6 @@ def resolve_cluster(arguments = {}) 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) || {} @@ -51,7 +50,11 @@ def resolve_cluster(arguments = {}) _name = arguments.delete(:name) method = Elasticsearch::API::HTTP_GET - path = "_resolve/cluster/#{Utils.__listify(_name)}" + path = if _name + "_resolve/cluster/#{Utils.__listify(_name)}" + else + '_resolve/cluster' + end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/inference/update.rb b/elasticsearch-api/lib/elasticsearch/api/actions/inference/update.rb index b7e8bb6d44..9f66563ee2 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/inference/update.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/inference/update.rb @@ -50,7 +50,7 @@ def update(arguments = {}) _task_type = arguments.delete(:task_type) - method = Elasticsearch::API::HTTP_POST + method = Elasticsearch::API::HTTP_PUT path = if _task_type && _inference_id "_inference/#{Utils.__listify(_task_type)}/#{Utils.__listify(_inference_id)}/_update" else diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/update.rb b/elasticsearch-api/lib/elasticsearch/api/actions/update.rb index 47e9ac19a5..64ad00ddea 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/update.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/update.rb @@ -37,6 +37,7 @@ module Actions # @option arguments [Number] :if_seq_no only perform the update operation if the last operation that has changed the document has the specified sequence number # @option arguments [Number] :if_primary_term only perform the update operation if the last operation that has changed the document has the specified primary term # @option arguments [Boolean] :require_alias When true, requires destination is an alias. Default is false + # @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. Defaults to true. # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The request definition requires either `script` or partial `doc` (*Required*) # diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/resolve_cluster_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/indices/resolve_cluster_spec.rb index 3da0771413..a4389d26b8 100644 --- a/elasticsearch-api/spec/elasticsearch/api/actions/indices/resolve_cluster_spec.rb +++ b/elasticsearch-api/spec/elasticsearch/api/actions/indices/resolve_cluster_spec.rb @@ -17,16 +17,15 @@ require 'spec_helper' -describe 'client.indices#delete_alias' do - +describe 'client.indices#resolve_cluster' do let(:expected_args) do [ 'GET', - '_resolve/cluster/foo', + path, {}, nil, {}, - { defined_params: { name: 'foo'}, endpoint: 'indices.resolve_cluster' } + otel ] end @@ -34,16 +33,22 @@ let(:client) do Class.new { include Elasticsearch::API }.new end + let(:path) { '_resolve/cluster' } + let(:otel) do + { endpoint: 'indices.resolve_cluster' } + end - it 'raises an exception' do - expect { - client.indices.resolve_cluster - }.to raise_exception(ArgumentError) + it 'performs the request' do + expect(client_double.indices.resolve_cluster).to be_a Elasticsearch::API::Response end end - context 'when name is specified' do + let(:path) { '_resolve/cluster/foo' } + let(:otel) do + { defined_params: { name: 'foo' }, endpoint: 'indices.resolve_cluster' } + end + it 'performs the request' do expect(client_double.indices.resolve_cluster(name: 'foo')).to be_a Elasticsearch::API::Response end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/update_spec.rb b/elasticsearch-api/spec/elasticsearch/api/actions/inference/update_spec.rb index a8fdbf1b7a..6f29cd0b58 100644 --- a/elasticsearch-api/spec/elasticsearch/api/actions/inference/update_spec.rb +++ b/elasticsearch-api/spec/elasticsearch/api/actions/inference/update_spec.rb @@ -20,7 +20,7 @@ describe 'client#inference.update' do let(:expected_args) do [ - 'POST', + 'PUT', '_inference/foo/bar/_update', {}, nil,