Method: Elasticsearch::API::SearchApplication::Actions#render_query

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

#render_query(arguments = {}) ⇒ Object

Renders a query for given search application search parameters 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 render the query for

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    Search parameters, which will override any default search parameters defined in the search application template

Raises:

  • (ArgumentError)

See Also:

[View source]

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

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

  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 = Elasticsearch::API::HTTP_POST
  path   = "_application/search_application/#{Utils.__listify(_name)}/_render_query"
  params = {}

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