From 8e238d2f4cc473c8f8230e4257d47537bf1202c9 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Fri, 19 Oct 2018 17:21:12 +0200 Subject: [PATCH] [API] Fix typos --- .../api/actions/count_percolate.rb | 5 ----- .../api/actions/delete_script.rb | 3 --- .../lib/elasticsearch/api/actions/explain.rb | 3 --- .../elasticsearch/api/actions/field_caps.rb | 19 ++++--------------- .../lib/elasticsearch/api/actions/get.rb | 3 --- .../api/actions/indices/delete_alias.rb | 2 +- .../api/actions/indices/put_alias.rb | 2 -- .../api/actions/indices/update_aliases.rb | 2 -- .../api/actions/msearch_template.rb | 9 ++++++--- .../api/actions/render_search_template.rb | 3 --- .../api/actions/snapshot/verify_repository.rb | 2 +- .../elasticsearch/api/actions/tasks/get.rb | 2 +- 12 files changed, 13 insertions(+), 42 deletions(-) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/count_percolate.rb b/elasticsearch-api/lib/elasticsearch/api/actions/count_percolate.rb index 8509ab4346..345e112b31 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/count_percolate.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/count_percolate.rb @@ -2,11 +2,6 @@ module Elasticsearch module API module Actions - # The valid parameters for this action. - # - # @since 6.0.1 - VALID_PARAMS = - # Return the number of queries matching a document. # # Percolator allows you to register queries and then evaluate a document against them: diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/delete_script.rb b/elasticsearch-api/lib/elasticsearch/api/actions/delete_script.rb index fdce06f901..511eee0672 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/delete_script.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/delete_script.rb @@ -13,9 +13,6 @@ module Actions # def delete_script(arguments={}) raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] - - valid_params = - method = HTTP_DELETE path = "_scripts/#{arguments.has_key?(:lang) ? "#{arguments.delete(:lang)}/" : ''}#{arguments[:id]}" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/explain.rb b/elasticsearch-api/lib/elasticsearch/api/actions/explain.rb index 9da3d25a62..7a1a0d8628 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/explain.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/explain.rb @@ -47,9 +47,6 @@ def explain(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'type' missing" unless arguments[:type] raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] - - valid_params = - method = HTTP_GET path = Utils.__pathify Utils.__escape(arguments[:index]), Utils.__escape(arguments[:type]), diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/field_caps.rb b/elasticsearch-api/lib/elasticsearch/api/actions/field_caps.rb index 6e8d105bda..de8f7a55b6 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/field_caps.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/field_caps.rb @@ -27,26 +27,15 @@ def field_caps(arguments={}) perform_request(method, path, params, body).body end + # Register this action with its valid params when the module is loaded. # # @since 6.1.1 ParamsRegistry.register(:field_caps, [ - :analyze_wildcard, - :analyzer, - :default_operator, - :df, :fields, - :lenient, - :lowercase_expanded_terms, - :parent, - :preference, - :q, - :routing, - :source, - :_source, - :_source_include, - :_source_exclude, - :stored_fields ].freeze) + :ignore_unavailable, + :allow_no_indices, + :expand_wildcards ].freeze) end end end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/get.rb b/elasticsearch-api/lib/elasticsearch/api/actions/get.rb index 487eeb881f..944f144af8 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/get.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/get.rb @@ -37,9 +37,6 @@ def get(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'id' missing" unless arguments[:id] arguments[:type] ||= UNDERSCORE_ALL - - valid_params = - method = HTTP_GET path = Utils.__pathify Utils.__escape(arguments[:index]), Utils.__escape(arguments[:type]), diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_alias.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_alias.rb index d120681dd4..5d4fa48334 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_alias.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/delete_alias.rb @@ -32,7 +32,7 @@ def delete_alias(arguments={}) # Register this action with its valid params when the module is loaded. # # @since 6.1.1 - ParamsRegistry.register(:delete, [ :timeout ].freeze) + ParamsRegistry.register(:delete_alias, [ :timeout ].freeze) end end end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_alias.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_alias.rb index 52997420f2..1eec7f7038 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_alias.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_alias.rb @@ -26,8 +26,6 @@ module Actions def put_alias(arguments={}) raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'name' missing" unless arguments[:name] - valid_params = [ :timeout ] - method = HTTP_PUT path = Utils.__pathify Utils.__listify(arguments[:index]), '_alias', Utils.__escape(arguments[:name]) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/update_aliases.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/update_aliases.rb index cab714540c..9829f3fd4c 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/update_aliases.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/update_aliases.rb @@ -32,8 +32,6 @@ module Actions # def update_aliases(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] - valid_params = [ :timeout ] - method = HTTP_POST path = "_aliases" diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/msearch_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/msearch_template.rb index d0f02e7969..f95495679f 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/msearch_template.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/msearch_template.rb @@ -20,13 +20,11 @@ module Actions # def msearch_template(arguments={}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] - - valid_params = [ :search_type ] method = HTTP_GET path = Utils.__pathify Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), '_msearch/template' - params = Utils.__validate_and_extract_params arguments, valid_params + params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) body = arguments[:body] case @@ -40,6 +38,11 @@ def msearch_template(arguments={}) perform_request(method, path, params, payload, {"Content-Type" => "application/x-ndjson"}).body end + + # Register this action with its valid params when the module is loaded. + # + # @since 6.1.1 + ParamsRegistry.register(:msearch_template, [ :search_type ].freeze) end end end diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/render_search_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/render_search_template.rb index bcc96615ad..f9d31a8f15 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/render_search_template.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/render_search_template.rb @@ -10,9 +10,6 @@ module Actions # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html # def render_search_template(arguments={}) - valid_params = [ - :id - ] method = 'GET' path = "_render/template" params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/snapshot/verify_repository.rb b/elasticsearch-api/lib/elasticsearch/api/actions/snapshot/verify_repository.rb index 022f061a34..27c2004315 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/snapshot/verify_repository.rb @@ -25,7 +25,7 @@ def verify_repository(arguments={}) # Register this action with its valid params when the module is loaded. # # @since 6.1.1 - ParamsRegistry.register(:status, [ + ParamsRegistry.register(:verify_repository, [ :repository, :master_timeout, :timeout ].freeze) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/tasks/get.rb b/elasticsearch-api/lib/elasticsearch/api/actions/tasks/get.rb index d74e03fbd1..1dbbb1d3b0 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/tasks/get.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/tasks/get.rb @@ -24,7 +24,7 @@ def get(arguments={}) # Register this action with its valid params when the module is loaded. # # @since 6.1.1 - ParamsRegistry.register(:cancel, [ :wait_for_completion ].freeze) + ParamsRegistry.register(:get, [ :wait_for_completion ].freeze) end end end