Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module Actions
#
# @option arguments [List] :index A comma-separated list of index names to limit the returned information
# @option arguments [String] :format a short version of the Accept header, e.g. json, yaml
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
# @option arguments [Time] :master_timeout Explicit operation timeout for connection to master node
# @option arguments [String] :bytes The unit in which to display byte values (options: b, k, kb, m, mb, g, gb, t, tb, p, pb)
# @option arguments [List] :h Comma-separated list of column names to display
# @option arguments [Boolean] :help Return help information
Expand Down
2 changes: 2 additions & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/cat/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ module Actions
# @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
# @option arguments [String] :time The unit in which to display time values (options: d, h, m, s, ms, micros, nanos)
# @option arguments [Boolean] :v Verbose mode. Display column headers
# @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.
# @option arguments [Boolean] :wait_for_completion If `true`, the request blocks until the task has completed.
# @option arguments [Hash] :headers Custom HTTP headers
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Enrich
module Actions
# Gets enrich coordinator statistics and information about enrich policies that are currently executing.
#
# @option arguments [Time] :master_timeout Timeout for processing on master node
# @option arguments [Time] :master_timeout Timeout for waiting for new cluster state in case it is blocked
# @option arguments [Hash] :headers Custom HTTP headers
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-stats-api.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module Actions
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
# @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 [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
# @option arguments [Hash] :headers Custom HTTP headers
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html
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/current/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
41 changes: 22 additions & 19 deletions elasticsearch-api/spec/unit/actions/indices/resolve_cluster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,35 @@
require 'spec_helper'

describe 'client.indices#delete_alias' do

let(:expected_args) do
[
'GET',
'_resolve/cluster/foo',
{},
nil,
{},
{ defined_params: { name: 'foo'}, endpoint: 'indices.resolve_cluster' }
]
end

context 'when there is no name specified' do
let(:client) do
Class.new { include Elasticsearch::API }.new
let(:expected_args) do
[
'GET',
'_resolve/cluster',
{},
nil,
{},
{ 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(:expected_args) do
[
'GET',
'_resolve/cluster/foo',
{},
nil,
{},
{ 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
Expand Down