Method: Elasticsearch::API::SearchApplication::Actions#put

Defined in:
lib/elasticsearch/api/actions/search_application/put.rb

#put(arguments = {}) ⇒ Object

Creates or updates a search application. This functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :name (String)

    The name of the search application to be created or updated

  • :create (Boolean)

    If true, requires that a search application with the specified resource_id does not already exist. (default: false)

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The search application configuration, including ‘indices` (Required)

Raises:

  • (ArgumentError)

See Also:


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

def put(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'search_application.put' }

  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   = "_application/search_application/#{Utils.__listify(_name)}"
  params = Utils.process_params(arguments)

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