# New python client (8.x) for sql query

**URL:** <https://discuss.elastic.co/t/new-python-client-8-x-for-sql-query/340083>\
**Category:** Elasticsearch\
**Created:** [August 3, 2023, 9:39pm UTC](https://discuss.elastic.co/t/new-python-client-8-x-for-sql-query/340083 "2023-08-03T21:39:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 3, 2023, 9:39pm UTC](https://discuss.elastic.co/t/new-python-client-8-x-for-sql-query/340083/1 "2023-08-03T21:39:46Z")

</div>

I am using sql query in my old python client 7.x and it works like this

`data = es.sql.query(body={"query": sql_query1, "fetch_size": 30000})`

now using new client 8.x it give me this warning  
` DeprecationWarning: The 'body' parameter is deprecated and will be removed in a future version. Instead use individual parameters.`

I can't figure out how to use this individual parameter. can't seems to find something related to that in document and don't see any example anywhere

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 16, 2023, 6:55pm UTC](https://discuss.elastic.co/t/new-python-client-8-x-for-sql-query/340083/2 "2023-08-16T18:55:16Z")

</div>

anyone has any idea?

---

<div class="post-metadata">

**Author:** ![Alex\_Salgado-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_salgado-elastic/32/103081_2.png) [@Alex\_Salgado-Elastic](https://discuss.elastic.co/u/Alex_Salgado-Elastic)\
**Post date:** [August 22, 2023, 11:21pm UTC](https://discuss.elastic.co/t/new-python-client-8-x-for-sql-query/340083/3 "2023-08-22T23:21:35Z")

</div>

Try the new syntax from : [Examples | Elasticsearch Python Client [8.9] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/examples.html#ex-get)

like

```auto
response = es.search(index="my-index", body= sql_query1, size=3000)

```

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 28, 2023, 12:52pm UTC](https://discuss.elastic.co/t/new-python-client-8-x-for-sql-query/340083/4 "2023-08-28T12:52:50Z")

</div>

ok this is how it works now.  
I am using sql query hence have to use es.sql.query  
you can use es.search if using rest query

data = es.sql.query(query = sql\_query1, fetch\_size= 10000)

---

<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 25, 2023, 12:53pm UTC](https://discuss.elastic.co/t/new-python-client-8-x-for-sql-query/340083/5 "2023-09-25T12:53:10Z")

</div>

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