# Does DBeaver client translate SQL queries to API calls?

**URL:** <https://discuss.elastic.co/t/does-dbeaver-client-translate-sql-queries-to-api-calls/338445>\
**Category:** Elasticsearch\
**Tags:** jdbc\
**Created:** [July 14, 2023, 11:40pm UTC](https://discuss.elastic.co/t/does-dbeaver-client-translate-sql-queries-to-api-calls/338445 "2023-07-14T23:40:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Z](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_z/32/122216_2.png) [@Mike\_Z](https://discuss.elastic.co/u/Mike_Z)\
**Post date:** [July 14, 2023, 11:40pm UTC](https://discuss.elastic.co/t/does-dbeaver-client-translate-sql-queries-to-api-calls/338445/1 "2023-07-14T23:40:28Z")

</div>

Following [this document](https://www.elastic.co/guide/en/elasticsearch/reference/8.6/sql-client-apps-dbeaver.html) we have created a DBeaver connection to a testing Elasticsearch instance running the 30-day trial license.

We tried SQL queries like `select * from "my-index-000001" limit 10;` and the DBeaver client got results like a relational database, although we know Elasticsearch is not relational.

For example, if the overall `_mapping` schema of the index contains an attribute like `eav_waiver` but the current document does not contain the attribute. Then DBeaver's behavior is to let the row display a default `NULL` on the corresponding column. Please let me know if I misunderstood something here.

**Our Question:**

Elasticsearch works with API calls by default, so we believe there must be a translation from SQL to API call in the DBeaver JDBC connection, right?

If yes, when running a SQL query, how can we check the translated API call?

We are new to Elasticsearch, so we highly appreciate any hints and suggestions.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 15, 2023, 2:53am UTC](https://discuss.elastic.co/t/does-dbeaver-client-translate-sql-queries-to-api-calls/338445/2 "2023-07-15T02:53:18Z")

</div>

Nope the translate happens on the elasticsearch side.

You can even see what it translates to

> **[SQL Translate API | Elasticsearch Guide \[8.8\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate.html)**

---

<div class="post-metadata">

**Author:** ![Mike\_Z](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_z/32/122216_2.png) [@Mike\_Z](https://discuss.elastic.co/u/Mike_Z)\
**Post date:** [July 17, 2023, 5:08pm UTC](https://discuss.elastic.co/t/does-dbeaver-client-translate-sql-queries-to-api-calls/338445/3 "2023-07-17T17:08:01Z")

</div>

Thank you, @stephenb.

Following your link, I got the below sample command:

```auto
# select * from "my-index-000001" limit 10;
POST /_sql/translate
{
  "query": "select * from \"my-index-000001\" limit 10"
}

# Result:
# {
# "size": 10,
# "_source": false,
# "fields": [
# {
# "field": "@timestamp",
# "format": "strict_date_optional_time_nanos"
# },
# {
# "field": "create_ts",
# "format": "strict_date_optional_time_nanos"
# },
#     
# ...
# ],
# "sort": [
# {
# "_doc": {
# "order": "asc"
# }
# }
# ],
# "track_total_hits": -1
# }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 14, 2023, 5:08pm UTC](https://discuss.elastic.co/t/does-dbeaver-client-translate-sql-queries-to-api-calls/338445/4 "2023-08-14T17:08:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
