Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/opensearch_sql_cli/opensearch_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ def __init__(
http_auth=None,
use_aws_authentication=False,
query_language="sql",
response_timeout=10
response_timeout=10,
serverless_override=None,
):
"""Initialize an OpenSearchConnection instance.

Set up client and get indices list.

:param endpoint: an url in the format of "http://localhost:9200"
:param http_auth: a tuple in the format of (username, password)
:param serverless_override: by default we analyze the provided endpoint string to determine
whether the endpoint is serverless or not. This option allows overriding that logic and
forcing the connection to be serverless (true) or not (false).
"""
self.client = None
self.ssl_context = None
Expand All @@ -47,7 +51,10 @@ def __init__(
self.use_aws_authentication = use_aws_authentication
self.query_language = query_language
self.response_timeout = response_timeout
self.is_aws_serverless = self.use_aws_authentication and ".aoss.amazonaws.com" in self.endpoint
if serverless_override is not None:
self.is_aws_serverless = serverless_override
else:
self.is_aws_serverless = self.use_aws_authentication and ".aoss.amazonaws.com" in self.endpoint

def get_indices(self):
if self.client:
Expand Down