From b9f5e2756582c9e3accf9abc3a75687e1b59a7bf Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Wed, 26 Feb 2025 15:52:52 +0000 Subject: [PATCH 1/3] [API] Updates ml.infer_trained_model to the elasticsearch-specification --- .../machine_learning/infer_trained_model.rb | 15 ++++++++------- .../infer_trained_model_deployment_spec.rb | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/machine_learning/infer_trained_model.rb b/elasticsearch-api/lib/elasticsearch/api/actions/machine_learning/infer_trained_model.rb index 59dbc17156..22631f81f9 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/machine_learning/infer_trained_model.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/machine_learning/infer_trained_model.rb @@ -15,8 +15,8 @@ # specific language governing permissions and limitations # under the License. # -# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80 -# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec +# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80 +# @see https://github.com/elastic/elasticsearch-specification # module Elasticsearch module API @@ -25,22 +25,23 @@ module Actions # Evaluate a trained model. # # @option arguments [String] :model_id The unique identifier of the trained model. (*Required*) - # @option arguments [Time] :timeout Controls the amount of time to wait for inference results. + # @option arguments [Time] :timeout Controls the amount of time to wait for inference results. Server default: 10s. # @option arguments [Hash] :headers Custom HTTP headers - # @option arguments [Hash] :body The docs to apply inference on and inference configuration overrides (*Required*) + # @option arguments [Hash] :body request body # # *Deprecation notice*: # /_ml/trained_models/{model_id}/deployment/_infer is deprecated. Use /_ml/trained_models/{model_id}/_infer instead # Deprecated since version 8.3.0 # # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-trained-model.html + # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-infer-trained-model # def infer_trained_model(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'ml.infer_trained_model' } - defined_params = [:model_id].each_with_object({}) do |variable, set_variables| + defined_params = [:model_id].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? @@ -55,7 +56,7 @@ def infer_trained_model(arguments = {}) _model_id = arguments.delete(:model_id) method = Elasticsearch::API::HTTP_POST - path = ("_ml/trained_models/#{Utils.__listify(_model_id)}/deployment/_infer" if _model_id) + path = "_ml/trained_models/#{Utils.__listify(_model_id)}/_infer" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( diff --git a/elasticsearch-api/spec/unit/actions/machine_learning/infer_trained_model_deployment_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/infer_trained_model_deployment_spec.rb index fccbe878bd..77964040e4 100644 --- a/elasticsearch-api/spec/unit/actions/machine_learning/infer_trained_model_deployment_spec.rb +++ b/elasticsearch-api/spec/unit/actions/machine_learning/infer_trained_model_deployment_spec.rb @@ -21,7 +21,7 @@ let(:expected_args) do [ 'POST', - '_ml/trained_models/foo/deployment/_infer', + '_ml/trained_models/foo/_infer', {}, {}, {}, From a767d2e8022f1474f6fa6c67919df62de7a4064f Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Wed, 26 Feb 2025 15:59:05 +0000 Subject: [PATCH 2/3] [API] Updates indices.simulate_index_template to elasticsearch-specification --- .../indices/simulate_index_template.rb | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/elasticsearch-api/lib/elasticsearch/api/actions/indices/simulate_index_template.rb b/elasticsearch-api/lib/elasticsearch/api/actions/indices/simulate_index_template.rb index 3817f9f5ca..a1f3f7ab50 100644 --- a/elasticsearch-api/lib/elasticsearch/api/actions/indices/simulate_index_template.rb +++ b/elasticsearch-api/lib/elasticsearch/api/actions/indices/simulate_index_template.rb @@ -15,30 +15,29 @@ # specific language governing permissions and limitations # under the License. # -# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80 -# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec +# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80 +# @see https://github.com/elastic/elasticsearch-specification # module Elasticsearch module API module Indices module Actions - # Simulate matching the given index name against the index templates in the system + # Simulate an index. + # Get the index configuration that would be applied to the specified index from an existing index template. # - # @option arguments [String] :name The name of the index (it must be a concrete index name) - # @option arguments [Boolean] :create Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one - # @option arguments [String] :cause User defined reason for dry-run creating the new template for simulation purposes - # @option arguments [Time] :master_timeout Specify timeout for connection to master - # @option arguments [Boolean] :include_defaults Return all relevant default configurations for this index template simulation (default: false) + # @option arguments [String] :name Name of the index to simulate (*Required*) + # @option arguments [Time] :master_timeout Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s. + # @option arguments [Boolean] :include_defaults If true, returns all relevant default configurations for the index template. # @option arguments [Hash] :headers Custom HTTP headers - # @option arguments [Hash] :body New index template definition, which will be included in the simulation, as if it already exists in the system # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-simulate-index.html + # @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-simulate-index-template # def simulate_index_template(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'indices.simulate_index_template' } - defined_params = [:name].each_with_object({}) do |variable, set_variables| + defined_params = [:name].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? @@ -47,7 +46,7 @@ def simulate_index_template(arguments = {}) arguments = arguments.clone headers = arguments.delete(:headers) || {} - body = arguments.delete(:body) + body = nil _name = arguments.delete(:name) From 0f90a2799d85410682a311dd72365c799e807880 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Wed, 26 Feb 2025 17:40:37 +0000 Subject: [PATCH 3/3] [CI] Remove soft fail from Serverless tests --- .buildkite/pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 747be2b7ce..87b2017899 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -55,8 +55,8 @@ steps: key: run-serverless-tests depends_on: - step: create-serverless - soft_fail: - - exit_status: 1 + # soft_fail: + # - exit_status: 1 agents: provider: "gcp" env: