diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/cat/segments.rb b/elasticsearch-api/lib/elasticsearch/api/actions/cat/segments.rb index 8898f52e26..e9146b30c8 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/cat/segments.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/cat/segments.rb @@ -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 diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/cat/tasks.rb b/elasticsearch-api/lib/elasticsearch/api/actions/cat/tasks.rb index 4a60aea199..bbbb3bb6c7 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/cat/tasks.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/cat/tasks.rb @@ -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 diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/enrich/stats.rb b/elasticsearch-api/lib/elasticsearch/api/actions/enrich/stats.rb index 8a71c336d4..d511f5f326 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/enrich/stats.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/enrich/stats.rb @@ -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 diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_field_mapping.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_field_mapping.rb index f4aad0249d..a28f41d72d 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/get_field_mapping.rb @@ -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 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 9f399ef567..8055280684 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/current/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/spec/unit/actions/indices/resolve_cluster_spec.rb b/elasticsearch-api/spec/unit/actions/indices/resolve_cluster_spec.rb index 3da0771413..46c477a9c7 100644 --- a/elasticsearch-api/spec/unit/actions/indices/resolve_cluster_spec.rb +++ b/elasticsearch-api/spec/unit/actions/indices/resolve_cluster_spec.rb @@ -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