Skip to content

Commit bace3f4

Browse files
committed
[API] Updates ml.infer_trained_model to the elasticsearch-specification
1 parent 7aedc17 commit bace3f4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

elasticsearch-api/lib/elasticsearch/api/actions/machine_learning/infer_trained_model.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
#
18-
# Auto generated from build hash f284cc16f4d4b4289bc679aa1529bb504190fe80
19-
# @see https://github.com/elastic/elasticsearch/tree/main/rest-api-spec
18+
# Auto generated from commit f284cc16f4d4b4289bc679aa1529bb504190fe80
19+
# @see https://github.com/elastic/elasticsearch-specification
2020
#
2121
module Elasticsearch
2222
module API
@@ -25,22 +25,23 @@ module Actions
2525
# Evaluate a trained model.
2626
#
2727
# @option arguments [String] :model_id The unique identifier of the trained model. (*Required*)
28-
# @option arguments [Time] :timeout Controls the amount of time to wait for inference results.
28+
# @option arguments [Time] :timeout Controls the amount of time to wait for inference results. Server default: 10s.
2929
# @option arguments [Hash] :headers Custom HTTP headers
30-
# @option arguments [Hash] :body The docs to apply inference on and inference configuration overrides (*Required*)
30+
# @option arguments [Hash] :body request body
3131
#
3232
# *Deprecation notice*:
3333
# /_ml/trained_models/{model_id}/deployment/_infer is deprecated. Use /_ml/trained_models/{model_id}/_infer instead
3434
# Deprecated since version 8.3.0
3535
#
3636
#
37-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-trained-model.html
37+
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-infer-trained-model
3838
#
3939
def infer_trained_model(arguments = {})
4040
request_opts = { endpoint: arguments[:endpoint] || 'ml.infer_trained_model' }
4141

42-
defined_params = [:model_id].each_with_object({}) do |variable, set_variables|
42+
defined_params = [:model_id].inject({}) do |set_variables, variable|
4343
set_variables[variable] = arguments[variable] if arguments.key?(variable)
44+
set_variables
4445
end
4546
request_opts[:defined_params] = defined_params unless defined_params.empty?
4647

@@ -55,7 +56,7 @@ def infer_trained_model(arguments = {})
5556
_model_id = arguments.delete(:model_id)
5657

5758
method = Elasticsearch::API::HTTP_POST
58-
path = ("_ml/trained_models/#{Utils.__listify(_model_id)}/deployment/_infer" if _model_id)
59+
path = "_ml/trained_models/#{Utils.__listify(_model_id)}/_infer"
5960
params = Utils.process_params(arguments)
6061

6162
Elasticsearch::API::Response.new(

elasticsearch-api/spec/unit/actions/machine_learning/infer_trained_model_deployment_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
let(:expected_args) do
2222
[
2323
'POST',
24-
'_ml/trained_models/foo/deployment/_infer',
24+
'_ml/trained_models/foo/_infer',
2525
{},
2626
{},
2727
{},

0 commit comments

Comments
 (0)