diff --git a/elasticsearch-api/utils/thor/templates/_method_setup.erb b/elasticsearch-api/utils/thor/templates/_method_setup.erb index 2ad4dc7ca8..6bcd79e63f 100644 --- a/elasticsearch-api/utils/thor/templates/_method_setup.erb +++ b/elasticsearch-api/utils/thor/templates/_method_setup.erb @@ -16,7 +16,6 @@ # specific language governing permissions and limitations # under the License. %> -<%= ' '*(@namespace_depth+4) %>arguments = arguments.clone <%- if @method_name == 'search' -%> arguments[:index] = UNDERSCORE_ALL if ! arguments[:index] && arguments[:type] <%- end -%> diff --git a/elasticsearch-api/utils/thor/templates/method.erb b/elasticsearch-api/utils/thor/templates/method.erb index 775a834832..ba49963edb 100644 --- a/elasticsearch-api/utils/thor/templates/method.erb +++ b/elasticsearch-api/utils/thor/templates/method.erb @@ -33,12 +33,14 @@ module Elasticsearch <%= ' '*(@namespace_depth+2) %>end <%- else -%> <%- if @method_name == 'get_field_mapping' %> + arguments = arguments.clone _fields = arguments.delete(:field) || arguments.delete(:fields) raise ArgumentError, "Required argument 'field' missing" unless _fields <%- else -%> <%- @required_parts.each do |required| %><%# Arguments -%> <%= ' '*(@namespace_depth+3) + "raise ArgumentError, \"Required argument '#{required}' missing\" unless arguments[:#{required}]" + "\n" -%> <%- end -%> + arguments = arguments.clone <%- end -%> headers = arguments.delete(:headers) || {} <%- #Body %>