Method: Elasticsearch::API::MachineLearning::Actions#get_trained_models

Defined in:
lib/elasticsearch/api/actions/machine_learning/get_trained_models.rb

#get_trained_models(arguments = {}) ⇒ Object

Retrieves configuration information for a trained inference model.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :model_id (String)

    The ID of the trained models to fetch

  • :allow_no_match (Boolean)

    Whether to ignore if a wildcard expression matches no trained models. (This includes ‘_all` string or when no trained models have been specified)

  • :include (String)

    A comma-separate list of fields to optionally include. Valid options are ‘definition’ and ‘total_feature_importance’. Default is none.

  • :include_model_definition (Boolean)

    Should the full model definition be included in the results. These definitions can be large. So be cautious when including them. Defaults to false. Deprecated

  • :decompress_definition (Boolean)

    Should the model definition be decompressed into valid JSON or returned in a custom compressed format. Defaults to true.

  • :from (Integer)

    skips a number of trained models

  • :size (Integer)

    specifies a max number of trained models to get

  • :tags (List)

    A comma-separated list of tags that the model must have.

  • :exclude_generated (Boolean)

    Omits fields that are illegal to set on model PUT

  • :headers (Hash)

    Custom HTTP headers

See Also:

[View source]

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/elasticsearch/api/actions/machine_learning/get_trained_models.rb', line 40

def get_trained_models(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ml.get_trained_models' }

  defined_params = [:model_id].each_with_object({}) do |variable, set_variables|
    set_variables[variable] = arguments[variable] if arguments.key?(variable)
  end
  request_opts[:defined_params] = defined_params unless defined_params.empty?

  arguments = arguments.clone
  headers = arguments.delete(:headers) || {}

  body = nil

  _model_id = arguments.delete(:model_id)

  method = Elasticsearch::API::HTTP_GET
  path   = if _model_id
             "_ml/trained_models/#{Utils.__listify(_model_id)}"
           else
             '_ml/trained_models'
           end
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end