---
name: "Search::Elasticsearch::Client::8_0::Direct::SQL"
section: "3pm"
platform: "linux"
package: "libsearch-elasticsearch-perl"
version: "8.12-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Search::Elasticsearch::Client::8_0::Direct::SQL"
---

# Search::Elasticsearch::Client::8\_0::Direct::SQL(3pm)

Plugin providing SQL for Search::Elasticsearch 8.x

## NAME

Search::Elasticsearch::Client::8\_0::Direct::SQL - Plugin providing SQL for Search::Elasticsearch 8.x

## VERSION

version 8.12

## SYNOPSIS

```
    my $response = $es->sql->query( body => {...} )
```

### DESCRIPTION

This class extends the Search::Elasticsearch client with an `"sql"` namespace, to support the SQL APIs \<https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html\>.

The full documentation for the SQL feature is available here: \<https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html\>

## GENERAL METHODS

### query()

```
    $response = $es->sql->query(
        body    => {...} # required
    )
```

The `query()` method executes an SQL query and returns the results.

Query string parameters:\
     `"error_trace"`,\
     `"filter_path"`,\
     `"format"`,\
     `"human"`

See the query docs \<https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html\> for more information.

### translate()

```
    $response = $es->sql->translate(
        body    => {...} # required
    )
```

The `translate()` method takes an SQL query and returns the query DSL which would be executed.

Query string parameters:\
     `"error_trace"`,\
     `"filter_path"`,\
     `"human"`

See the translate docs \<https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate.html\> for more information.

### clear\_cursor()

```
    $response = $es->sql->clear_cursor(
        body    => {...} # required
    )
```

The `clear_cursor()` method cleans up an ongoing scroll request.

Query string parameters:\
     `"error_trace"`,\
     `"filter_path"`,\
     `"human"`

See the query docs \<https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html\> for more information.

## AUTHOR

Enrico Zimuel \<enrico.zimuel@elastic.co\>

## COPYRIGHT AND LICENSE

This software is Copyright (c) 2024 by Elasticsearch BV.

This is free software, licensed under:

```
  The Apache License, Version 2.0, January 2004
```
