Skip to content

Commit

Permalink
[API] Adds include_source_on_error parameter. True or false if to
Browse files Browse the repository at this point in the history
include the document source in the error message in case of parsing
errors. Defaults to true.

Affected APIs: bulk, create, index, update

indices.resolve_cluster - Adds timeout, name no longer a required parameter
  • Loading branch information
picandocodigo committed Feb 3, 2025
1 parent 3905d2d commit bdff013
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
#
Expand Down
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) || {}

Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
#
Expand Down

0 comments on commit bdff013

Please sign in to comment.