Method: Elasticsearch::API::Transform::Actions#preview_transform

Defined in:
lib/elasticsearch/api/actions/transform/preview_transform.rb

#preview_transform(arguments = {}) ⇒ Object

Previews a transform.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :transform_id (String)

    The id of the transform to preview.

  • :timeout (Time)

    Controls the time to wait for the preview

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The definition for the transform to preview

See Also:



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

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

  body = arguments.delete(:body)

  _transform_id = arguments.delete(:transform_id)

  method = if body
             Elasticsearch::API::HTTP_POST
           else
             Elasticsearch::API::HTTP_GET
           end

  path   = if _transform_id
             "_transform/#{Utils.__listify(_transform_id)}/_preview"
           else
             "_transform/_preview"
           end
  params = Utils.process_params(arguments)

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