Method: Elasticsearch::API::MachineLearning::Actions#clear_trained_model_deployment_cache

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

#clear_trained_model_deployment_cache(arguments = {}) ⇒ Object

Clear the cached results from a trained model deployment

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :model_id (String)

    The unique identifier of the trained model. (Required)

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/elasticsearch/api/actions/machine_learning/clear_trained_model_deployment_cache.rb', line 32

def clear_trained_model_deployment_cache(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || "ml.clear_trained_model_deployment_cache" }

  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?

  raise ArgumentError, "Required argument 'model_id' missing" unless arguments[:model_id]

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

  body = nil

  _model_id = arguments.delete(:model_id)

  method = Elasticsearch::API::HTTP_POST
  path   = "_ml/trained_models/#{Utils.__listify(_model_id)}/deployment/cache/_clear"
  params = {}

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