lib/elasticsearch/api/actions/mtermvectors.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/mtermvectors.rb in elasticsearch-api-8.13.0

- old
+ new

@@ -37,26 +37,25 @@ # @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 [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.12/docs-multi-termvectors.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/docs-multi-termvectors.html # def mtermvectors(arguments = {}) - request_opts = { endpoint: arguments[:endpoint] || "mtermvectors" } + request_opts = { endpoint: arguments[:endpoint] || 'mtermvectors' } - defined_params = [:index].inject({}) do |set_variables, variable| + defined_params = [:index].each_with_object({}) do |variable, set_variables| set_variables[variable] = arguments[variable] if arguments.key?(variable) - set_variables end request_opts[:defined_params] = defined_params unless defined_params.empty? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = if (ids = arguments.delete(:ids)) - { :ids => ids } + { ids: ids } else arguments.delete(:body) end _index = arguments.delete(:index) @@ -65,14 +64,14 @@ Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end - path = if _index - "#{Utils.__listify(_index)}/_mtermvectors" - else - "_mtermvectors" - end + path = if _index + "#{Utils.__listify(_index)}/_mtermvectors" + else + '_mtermvectors' + end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) )