Module: Elasticsearch::API::Esql::Actions

Included in:
EsqlClient
Defined in:
lib/elasticsearch/api/namespace/esql.rb,
lib/elasticsearch/api/actions/esql/query.rb
more...

Instance Method Summary collapse

Instance Method Details

#query(arguments = {}) ⇒ Object

Executes an ESQL request 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):

  • :format (String)

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

  • :delimiter (String)

    The character to use between values within a CSV row. Only valid for the csv format.

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    Use the ‘query` element to start a query. Use `time_zone` to specify an execution time zone and `columnar` to format the answer. (Required)

Raises:

  • (ArgumentError)

See Also:

[View source]

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/elasticsearch/api/actions/esql/query.rb', line 38

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