Method: OpenSearch::API::Ingest::Actions#simulate

Defined in:
lib/opensearch/api/actions/ingest/simulate.rb

#simulate(arguments = {}) ⇒ Object

Allows to simulate a pipeline with example documents.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :id (String)

    Pipeline ID

  • :verbose (Boolean)

    Verbose mode. Display data output for each processor in executed pipeline

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The simulate definition (Required)

Raises:

  • (ArgumentError)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/opensearch/api/actions/ingest/simulate.rb', line 39

def simulate(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

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

  arguments = arguments.clone

  _id = arguments.delete(:id)

  method = OpenSearch::API::HTTP_POST
  path   = if _id
             "_ingest/pipeline/#{Utils.__listify(_id)}/_simulate"
           else
             "_ingest/pipeline/_simulate"
           end
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end