Method: Elasticsearch::API::SearchApplication::Actions#search

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

#search(arguments = {}) ⇒ Object

Perform a search against 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 searched

  • :typed_keys (Boolean)

    Specify whether aggregation and suggester names should be prefixed by their respective types in the response

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    Search parameters, including template parameters that override defaults

Raises:

  • (ArgumentError)

See Also:

[View source]

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
64
65
66
67
# File 'lib/elasticsearch/api/actions/search_application/search.rb', line 38

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

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

  _name = arguments.delete(:name)

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

  path = "_application/search_application/#{Utils.__listify(_name)}/_search"
  params = Utils.process_params(arguments)

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