lib/elasticsearch/api/actions/count.rb in elasticsearch-api-8.10.0 vs lib/elasticsearch/api/actions/count.rb in elasticsearch-api-8.11.0

- old
+ new

@@ -39,13 +39,21 @@ # @option arguments [Boolean] :lenient Specify whether format-based query failures (such as providing text to a numeric field) should be ignored # @option arguments [Number] :terminate_after The maximum count for each shard, upon reaching which the query execution will terminate early # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body A query to restrict the results specified with the Query DSL (optional) # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-count.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/search-count.html # def count(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || "count" } + + defined_params = [:index].inject({}) do |set_variables, variable| + 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 = arguments.delete(:body) @@ -63,10 +71,10 @@ "_count" end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( - perform_request(method, path, params, body, headers) + perform_request(method, path, params, body, headers, request_opts) ) end end end end