Module: Elasticsearch::XPack::API::SQL::Actions

Included in:
SQLClient
Defined in:
lib/elasticsearch/xpack/api/namespace/sql.rb,
lib/elasticsearch/xpack/api/actions/sql/query.rb,
lib/elasticsearch/xpack/api/actions/sql/translate.rb,
lib/elasticsearch/xpack/api/actions/sql/clear_cursor.rb

Instance Method Summary collapse

Instance Method Details

#clear_cursor(arguments = {}) ⇒ Object

TODO: Description

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    Specify the cursor value in the ‘cursor` element to clean the cursor. (Required)

Raises:

  • (ArgumentError)

See Also:

  • SQL cursor


17
18
19
20
21
22
23
24
25
# File 'lib/elasticsearch/xpack/api/actions/sql/clear_cursor.rb', line 17

def clear_cursor(arguments={})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  method = Elasticsearch::API::HTTP_POST
  path   = "_xpack/sql/close"
  params = {}
  body   = arguments[:body]

  perform_request(method, path, params, body).body
end

#query(arguments = {}) ⇒ Object

TODO: Description

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    Use the ‘query` element to start a query. Use the `cursor` element to continue a query. (Required)

  • :format (String)

    a short version of the Accept header, e.g. json, yaml

Raises:

  • (ArgumentError)

See Also:

  • SQL


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/elasticsearch/xpack/api/actions/sql/query.rb', line 18

def query(arguments={})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  valid_params = [
    :format ]
  method = Elasticsearch::API::HTTP_POST
  path   = "_xpack/sql"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
  body   = arguments[:body]

  perform_request(method, path, params, body).body
end

#translate(arguments = {}) ⇒ Object

TODO: Description

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :body (Hash)

    Specify the query in the ‘query` element. (Required)

Raises:

  • (ArgumentError)

See Also:

  • SQL into Elasticsearch queries


17
18
19
20
21
22
23
24
25
# File 'lib/elasticsearch/xpack/api/actions/sql/translate.rb', line 17

def translate(arguments={})
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
  method = Elasticsearch::API::HTTP_POST
  path   = "_xpack/sql/translate"
  params = {}
  body   = arguments[:body]

  perform_request(method, path, params, body).body
end