def query(
        self,
        *,
        allow_partial_search_results: t.Optional[bool] = None,
        catalog: t.Optional[str] = None,
        columnar: t.Optional[bool] = None,
        cursor: t.Optional[str] = None,
        error_trace: t.Optional[bool] = None,
        fetch_size: t.Optional[int] = None,
        field_multi_value_leniency: t.Optional[bool] = None,
        filter: t.Optional[t.Mapping[str, t.Any]] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        format: t.Optional[
            t.Union[
                str, t.Literal["cbor", "csv", "json", "smile", "tsv", "txt", "yaml"]
            ]
        ] = None,
        human: t.Optional[bool] = None,
        index_using_frozen: t.Optional[bool] = None,
        keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
        keep_on_completion: t.Optional[bool] = None,
        page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
        params: t.Optional[t.Mapping[str, t.Any]] = None,
        pretty: t.Optional[bool] = None,
        query: t.Optional[str] = None,
        request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
        runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
        time_zone: t.Optional[str] = None,
        wait_for_completion_timeout: t.Optional[
            t.Union[str, t.Literal[-1], t.Literal[0]]
        ] = None,
        body: t.Optional[t.Dict[str, t.Any]] = None,
    ) -> ObjectApiResponse[t.Any]:
        """
        .. raw:: html

          <p>Get SQL search results.
          Run an SQL request.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-sql-query>`_

        :param 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.
        :param catalog: The default catalog (cluster) for queries. If unspecified, the
            queries execute on the data in the local cluster only.
        :param 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.
        :param cursor: 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.
        :param fetch_size: The maximum number of rows (or entries) to return in one response.
        :param 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.
        :param filter: The Elasticsearch query DSL for additional filtering.
        :param format: 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.
        :param index_using_frozen: If `true`, the search can run on frozen indices.
        :param keep_alive: The retention period for an async or saved synchronous search.
        :param 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`.
        :param page_timeout: 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.
        :param params: The values for parameters in the query.
        :param query: The SQL query to run.
        :param request_timeout: The timeout before the request fails.
        :param runtime_mappings: One or more runtime fields for the search request. These
            fields take precedence over mapped fields with the same name.
        :param time_zone: The ISO-8601 time zone ID for the search.
        :param wait_for_completion_timeout: 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.
        """
        __path_parts: t.Dict[str, str] = {}
        __path = "/_sql"
        __query: t.Dict[str, t.Any] = {}
        __body: t.Dict[str, t.Any] = body if body is not None else {}
        if error_trace is not None:
            __query["error_trace"] = error_trace
        if filter_path is not None:
            __query["filter_path"] = filter_path
        if format is not None:
            __query["format"] = format
        if human is not None:
            __query["human"] = human
        if pretty is not None:
            __query["pretty"] = pretty
        if not __body:
            if allow_partial_search_results is not None:
                __body["allow_partial_search_results"] = allow_partial_search_results
            if catalog is not None:
                __body["catalog"] = catalog
            if columnar is not None:
                __body["columnar"] = columnar
            if cursor is not None:
                __body["cursor"] = cursor
            if fetch_size is not None:
                __body["fetch_size"] = fetch_size
            if field_multi_value_leniency is not None:
                __body["field_multi_value_leniency"] = field_multi_value_leniency
            if filter is not None:
                __body["filter"] = filter
            if index_using_frozen is not None:
                __body["index_using_frozen"] = index_using_frozen
            if keep_alive is not None:
                __body["keep_alive"] = keep_alive
            if keep_on_completion is not None:
                __body["keep_on_completion"] = keep_on_completion
            if page_timeout is not None:
                __body["page_timeout"] = page_timeout
            if params is not None:
                __body["params"] = params
            if query is not None:
                __body["query"] = query
            if request_timeout is not None:
                __body["request_timeout"] = request_timeout
            if runtime_mappings is not None:
                __body["runtime_mappings"] = runtime_mappings
            if time_zone is not None:
                __body["time_zone"] = time_zone
            if wait_for_completion_timeout is not None:
                __body["wait_for_completion_timeout"] = wait_for_completion_timeout
        __headers = {"accept": "application/json", "content-type": "application/json"}
        return self.perform_request(  # type: ignore[return-value]
            "POST",
            __path,
            params=__query,
            headers=__headers,
            body=__body,
            endpoint_id="sql.query",
            path_parts=__path_parts,
        )

        .. raw:: html

          <p>Get SQL search results.
          Run an SQL request.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-sql-query>`_

        :param 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.
        :param catalog: The default catalog (cluster) for queries. If unspecified, the
            queries execute on the data in the local cluster only.
        :param 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.
        :param cursor: 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.
        :param fetch_size: The maximum number of rows (or entries) to return in one response.
        :param 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.
        :param filter: The Elasticsearch query DSL for additional filtering.
        :param format: 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.
        :param index_using_frozen: If `true`, the search can run on frozen indices.
        :param keep_alive: The retention period for an async or saved synchronous search.
        :param 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`.
        :param page_timeout: 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.
        :param params: The values for parameters in the query.
        :param query: The SQL query to run.
        :param request_timeout: The timeout before the request fails.
        :param runtime_mappings: One or more runtime fields for the search request. These
            fields take precedence over mapped fields with the same name.
        :param time_zone: The ISO-8601 time zone ID for the search.
        :param wait_for_completion_timeout: 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.
        
elasticsearch/_sync/client/sql.py