# ES 6.3.2 elasticsearch-py API with \_xpack/sql

**URL:** <https://discuss.elastic.co/t/es-6-3-2-elasticsearch-py-api-with-xpack-sql/143729>\
**Category:** Elasticsearch\
**Created:** [August 9, 2018, 3:44pm UTC](https://discuss.elastic.co/t/es-6-3-2-elasticsearch-py-api-with-xpack-sql/143729 "2018-08-09T15:44:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [August 9, 2018, 3:44pm UTC](https://discuss.elastic.co/t/es-6-3-2-elasticsearch-py-api-with-xpack-sql/143729/1 "2018-08-09T15:44:12Z")

</div>

Hi Guys,

A quick question please.

I am playing around with the new SQL syntax feature: [https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-syntax-select.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-syntax-select.html)

But I noticed that the [SQL Rest API](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html) is currently not available in the official [elasticsearch-py API](https://elasticsearch-py.readthedocs.io/en/master/xpack.html) yet - or maybe I'm missing something?

I am currently working around this by using the [`Transport.perform_request()`](https://elasticsearch-py.readthedocs.io/en/master/connection.html#elasticsearch.Transport.perform_request) function to perform the request like so but if you know a better way please do let me know:

```
# 'es' is the instantiated Elasticsearch client

query = {
    "query": 'SELECT some_field FROM "some_table" LIMIT 10'
}

results = es.transport.perform_request('POST', '/_xpack/sql', params={'format': 'json'}, body=query)

```

Cheers,

---

<div class="post-metadata">

**Author:** ![Andrei\_Stefan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei_stefan/32/47533_2.png) [@Andrei\_Stefan](https://discuss.elastic.co/u/Andrei_Stefan)\
**Post date:** [August 13, 2018, 7:19am UTC](https://discuss.elastic.co/t/es-6-3-2-elasticsearch-py-api-with-xpack-sql/143729/2 "2018-08-13T07:19:33Z")

</div>

Hey there,  
I am not aware of an implementation either. But, as you did, you could use any mean of sending an HTTP request to Elasticsearch with the appropriate endpoint to get a response back.

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [August 13, 2018, 9:38am UTC](https://discuss.elastic.co/t/es-6-3-2-elasticsearch-py-api-with-xpack-sql/143729/3 "2018-08-13T09:38:37Z")

</div>

Thanks!

---

<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:** [September 10, 2018, 9:38am UTC](https://discuss.elastic.co/t/es-6-3-2-elasticsearch-py-api-with-xpack-sql/143729/4 "2018-09-10T09:38:37Z")

</div>

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