Method: Elasticsearch::API::MachineLearning::Actions#delete_expired_data

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

#delete_expired_data(arguments = {}) ⇒ Object

Deletes expired and unused machine learning data.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :job_id (String)

    The ID of the job(s) to perform expired data hygiene for

  • :requests_per_second (Number)

    The desired requests per second for the deletion processes.

  • :timeout (Time)

    How long can the underlying delete processes run until they are canceled

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    deleting expired data parameters

See Also:

[View source]

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

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

  defined_params = [:job_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 = arguments.delete(:body)

  _job_id = arguments.delete(:job_id)

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

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