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

- old
+ new

@@ -40,13 +40,21 @@ # @option arguments [Boolean|long] :track_total_hits Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number. # @option arguments [Boolean] :with_labels If true, the hits and aggs layers will contain additional point features with suggested label positions for the original features. # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body Search request body. # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-vector-tile-api.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/search-vector-tile-api.html # def search_mvt(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || "search_mvt" } + + defined_params = [:index, :field, :zoom, :x, :y].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? + raise ArgumentError, "Required argument 'index' missing" unless arguments[:index] raise ArgumentError, "Required argument 'field' missing" unless arguments[:field] raise ArgumentError, "Required argument 'zoom' missing" unless arguments[:zoom] raise ArgumentError, "Required argument 'x' missing" unless arguments[:x] raise ArgumentError, "Required argument 'y' missing" unless arguments[:y] @@ -69,10 +77,10 @@ method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_mvt/#{Utils.__listify(_field)}/#{Utils.__listify(_zoom)}/#{Utils.__listify(_x)}/#{Utils.__listify(_y)}" 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