module Elasticsearch::XPack::API::SQL::Actions

Public Instance Methods

clear_cursor(arguments = {}) click to toggle source

Clears the SQL cursor

@option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Specify the cursor value in the `cursor` element to clean the cursor. (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/sql-pagination.html

# File lib/elasticsearch/xpack/api/actions/sql/clear_cursor.rb, line 30
def clear_cursor(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

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

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_sql/close"
  params = {}

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
delete_async(arguments = {}) click to toggle source

Deletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it.

@option arguments [String] :id The async search ID @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/delete-async-sql-search-api.html

# File lib/elasticsearch/xpack/api/actions/sql/delete_async.rb, line 30
def delete_async(arguments = {})
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]

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

  arguments = arguments.clone

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_sql/async/delete/#{Elasticsearch::API::Utils.__listify(_id)}"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
get_async(arguments = {}) click to toggle source

Returns the current status and available results for an async SQL search or stored synchronous SQL search

@option arguments [String] :id The async search ID @option arguments [String] :delimiter Separator for CSV results @option arguments [String] :format Short version of the Accept header, e.g. json, yaml @option arguments [Time] :keep_alive Retention period for the search and its results @option arguments [Time] :wait_for_completion_timeout Duration to wait for complete results @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/get-async-sql-search-api.html

# File lib/elasticsearch/xpack/api/actions/sql/get_async.rb, line 34
def get_async(arguments = {})
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]

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

  arguments = arguments.clone

  _id = arguments.delete(:id)

  method = Elasticsearch::API::HTTP_GET
  path   = "_sql/async/#{Elasticsearch::API::Utils.__listify(_id)}"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
get_async_status(arguments = {}) click to toggle source

Returns the current status of an async SQL search or a stored synchronous SQL search

@option arguments [String] :id The async search ID @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/get-async-sql-search-status-api.html

# File lib/elasticsearch/xpack/api/actions/sql/get_async_status.rb, line 30
def get_async_status(arguments = {})
  raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]

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

  arguments = arguments.clone

  _id = arguments.delete(:id)

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

  body = nil
  perform_request(method, path, params, body, headers).body
end
query(arguments = {}) click to toggle source

Executes a SQL request

@option arguments [String] :format a short version of the Accept header, e.g. json, yaml @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Use the `query` element to start a query. Use the `cursor` element to continue a query. (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/sql-rest-overview.html

# File lib/elasticsearch/xpack/api/actions/sql/query.rb, line 31
def query(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

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

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_sql"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
translate(arguments = {}) click to toggle source

Translates SQL into Elasticsearch queries

@option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Specify the query in the `query` element. (Required)

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/sql-translate.html

# File lib/elasticsearch/xpack/api/actions/sql/translate.rb, line 30
def translate(arguments = {})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

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

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_sql/translate"
  params = {}

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end