﻿---
title: stack es sql query cli command
description: Get SQL search results. Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4083/reference/elastic-cli/cli/stack/es/sql/query
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack es sql query cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack es sql query [options]
```

Get SQL search results.
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--format enum">
    The format for the response.
    You can also specify a format using the `Accept` HTTP header.
    If you specify both this parameter and the `Accept` HTTP header, this parameter takes precedence.
    **Values:** csv, json, tsv, txt, yaml, cbor, smile
  </definition>
  <definition term="--allow-partial-search-results">
    If `true`, the response has partial results when there are shard request timeouts or shard failures.
    If `false`, the API returns an error with no partial results.
  </definition>
  <definition term="--catalog string">
    The default catalog (cluster) for queries.
    If unspecified, the queries execute on the data in the local cluster only.
  </definition>
  <definition term="--columnar">
    If `true`, the results are in a columnar fashion: one row represents all the values of a certain column from the current page of results.
    The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses.
  </definition>
  <definition term="--cursor string">
    The cursor used to retrieve a set of paginated results.
    If you specify a cursor, the API only uses the `columnar` and `time_zone` request body parameters.
    It ignores other request body parameters.
  </definition>
  <definition term="--fetch-size number">
    The maximum number of rows (or entries) to return in one response.
  </definition>
  <definition term="--field-multi-value-leniency">
    If `false`, the API returns an exception when encountering multiple values for a field.
    If `true`, the API is lenient and returns the first value from the array with no guarantee of consistent results.
  </definition>
  <definition term="--filter string">
    The Elasticsearch query DSL for additional filtering.
  </definition>
  <definition term="--index-using-frozen">
    If `true`, the search can run on frozen indices.
  </definition>
  <definition term="--keep-alive string">
    The retention period for an async or saved synchronous search.
  </definition>
  <definition term="--keep-on-completion">
    If `true`, Elasticsearch stores synchronous searches if you also specify the `wait_for_completion_timeout` parameter.
    If `false`, Elasticsearch only stores async searches that don't finish before the `wait_for_completion_timeout`.
  </definition>
  <definition term="--page-timeout string">
    The minimum retention period for the scroll cursor.
    After this time period, a pagination request might fail because the scroll cursor is no longer available.
    Subsequent scroll requests prolong the lifetime of the scroll cursor by the duration of `page_timeout` in the scroll request.
  </definition>
  <definition term="--params string[]">
    The values for parameters in the query.
    **Repeatable:** pass `--params` multiple times to supply more than one value
  </definition>
  <definition term="--query string">
    The SQL query to run.
  </definition>
  <definition term="--request-timeout string">
    The timeout before the request fails.
  </definition>
  <definition term="--runtime-mappings string">
    One or more runtime fields for the search request.
    These fields take precedence over mapped fields with the same name.
  </definition>
  <definition term="--time-zone string">
    The ISO-8601 time zone ID for the search.
  </definition>
  <definition term="--wait-for-completion-timeout string">
    The period to wait for complete results.
    It defaults to no timeout, meaning the request waits for complete search results.
    If the search doesn't finish within this period, the search becomes async. To save a synchronous search, you must specify this parameter and the `keep_on_completion` parameter.
  </definition>
  <definition term="--error-trace">
    When set to `true` Elasticsearch will include the full stack trace of errors
    when they occur.
  </definition>
  <definition term="--filter-path string">
    Comma-separated list of filters in dot notation which reduce the response
    returned by Elasticsearch.
    **Repeatable:** pass `--filter-path` multiple times to supply more than one value
  </definition>
  <definition term="--human">
    When set to `true` will return statistics in a format suitable for humans.
    For example `"exists_time": "1h"` for humans and
    `"exists_time_in_millis": 3600000` for computers. When disabled the human
    readable values will be omitted. This makes sense for responses being consumed
    only by machines.
  </definition>
  <definition term="--pretty">
    If set to `true` the returned JSON will be "pretty-formatted". Only use
    this option for debugging only.
  </definition>
  <definition term="--input-file string">
    path to a JSON file to use as command input
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>