module Elasticsearch::API::Enrich::Actions

Public Instance Methods

delete_policy(arguments = {}) click to toggle source

Deletes an existing enrich policy and its enrich index.

@option arguments [String] :name The name of the enrich policy @option arguments [Time] :master_timeout Timeout for processing on master node @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/delete-enrich-policy-api.html

# File lib/elasticsearch/api/actions/enrich/delete_policy.rb, line 33
def delete_policy(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'enrich.delete_policy' }

  defined_params = [:name].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?

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

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

  body = nil

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_enrich/policy/#{Utils.__listify(_name)}"
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
execute_policy(arguments = {}) click to toggle source

Creates the enrich index for an existing enrich policy.

@option arguments [String] :name The name of the enrich policy @option arguments [Boolean] :wait_for_completion Should the request should block until the execution is complete. @option arguments [Time] :master_timeout Timeout for processing on master node @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/execute-enrich-policy-api.html

# File lib/elasticsearch/api/actions/enrich/execute_policy.rb, line 34
def execute_policy(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'enrich.execute_policy' }

  defined_params = [:name].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?

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

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

  body = nil

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_enrich/policy/#{Utils.__listify(_name)}/_execute"
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
get_policy(arguments = {}) click to toggle source

Gets information about an enrich policy.

@option arguments [List] :name A comma-separated list of enrich policy names @option arguments [Time] :master_timeout Timeout for processing on master node @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/get-enrich-policy-api.html

# File lib/elasticsearch/api/actions/enrich/get_policy.rb, line 33
def get_policy(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'enrich.get_policy' }

  defined_params = [:name].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

  _name = arguments.delete(:name)

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
put_policy(arguments = {}) click to toggle source

Creates a new enrich policy.

@option arguments [String] :name The name of the enrich policy @option arguments [Time] :master_timeout Timeout for processing on master node @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The enrich policy to register (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/put-enrich-policy-api.html

# File lib/elasticsearch/api/actions/enrich/put_policy.rb, line 34
def put_policy(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'enrich.put_policy' }

  defined_params = [:name].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?

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

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

  body = arguments.delete(:body)

  _name = arguments.delete(:name)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_enrich/policy/#{Utils.__listify(_name)}"
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end
stats(arguments = {}) click to toggle source

Gets enrich coordinator statistics and information about enrich policies that are currently executing.

@option arguments [Time] :master_timeout Timeout for processing on master node @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/enrich-stats-api.html

# File lib/elasticsearch/api/actions/enrich/stats.rb, line 32
def stats(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'enrich.stats' }

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

  body   = nil

  method = Elasticsearch::API::HTTP_GET
  path   = '_enrich/_stats'
  params = Utils.process_params(arguments)

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