module Elasticsearch::API::Esql::Actions

Public Instance Methods

async_query(arguments = {}) click to toggle source

Executes an ESQL request asynchronously

@option arguments [String] :format a short version of the Accept header, e.g. json, yaml @option arguments [String] :delimiter The character to use between values within a CSV row. Only valid for the csv format. @option arguments [Boolean] :drop_null_columns Should entirely null columns be removed from the results? Their name and type will be returning in a new ‘all_columns` section. @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Use the `query` element to start a query. Use `columnar` to format the answer. (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/esql-async-query-api.html

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

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

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

  body   = arguments.delete(:body)

  method = Elasticsearch::API::HTTP_POST
  path   = '_query/async'
  params = Utils.process_params(arguments)

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

Retrieves the results of a previously submitted async query request given its ID.

@option arguments [String] :id The async query ID @option arguments [Time] :wait_for_completion_timeout Specify the time that the request should block waiting for the final response @option arguments [Time] :keep_alive Specify the time interval in which the results (partial or final) for this search will be available @option arguments [Boolean] :drop_null_columns Should entirely null columns be removed from the results? Their name and type will be returning in a new ‘all_columns` section. @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/esql-async-query-get-api.html

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

  defined_params = [:id].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 'id' missing" unless arguments[:id]

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

  body = nil

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_GET
  path   = "_query/async/#{Utils.__listify(_id)}"
  params = Utils.process_params(arguments)

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

Executes an ESQL request

@option arguments [String] :format a short version of the Accept header, e.g. json, yaml @option arguments [String] :delimiter The character to use between values within a CSV row. Only valid for the csv format. @option arguments [Boolean] :drop_null_columns Should entirely null columns be removed from the results? Their name and type will be returning in a new ‘all_columns` section. @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Use the `query` element to start a query. Use `columnar` to format the answer. (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/8.16/esql-query-api.html

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

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

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

  body   = arguments.delete(:body)

  method = Elasticsearch::API::HTTP_POST
  path   = '_query'
  params = Utils.process_params(arguments)

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