X-pack and sql in python

Trying to see how i can call the x-pack sql feature in python. Am I invoking xpack client correctly

AttributeError: 'XPackClient' object has no attribute 'sql'

from elasticsearch import Elasticsearch, RequestsHttpConnection
from requests_aws4auth import AWS4Auth
from elasticsearch_xpack import XPackClient
import boto3

host = ''
region = ''

service = 'es'
credentials = boto3.Session().get_credentials()
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token)

es = Elasticsearch(
hosts = [{'host': host, 'port': 443}],
http_auth = awsauth,
use_ssl = True,
verify_certs = True,
connection_class = RequestsHttpConnection
xpack = XPackClient(es)
document = {
"query": "SELECT * FROM movies ORDER BY id DESC",
"fetch_size": 2

body = document,
format = 'json'

Which version of Elasticsearch are you using? What does the elasticsearch.yml file look like? What do you get if you run the info API?

apologies .. turns out aws - elasticsearch offering does not have x-pack installed in their server.they support another sql engine.

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