awswrangler.opensearch.search_by_sql

awswrangler.opensearch.search_by_sql(client: opensearchpy.client.OpenSearch, sql_query: str, **kwargs: Any) pandas.core.frame.DataFrame

Return results matching SQL query as pandas dataframe.

Parameters
  • client (OpenSearch) – instance of opensearchpy.OpenSearch to use.

  • sql_query (str) – SQL query

  • **kwargs – KEYWORD arguments forwarded to request url (e.g.: filter_path, etc.)

Returns

Results as Pandas DataFrame

Return type

Union[pandas.DataFrame, Iterator[pandas.DataFrame]]

Examples

Searching an index using SQL query

>>> import awswrangler as wr
>>> client = wr.opensearch.connect(host='DOMAIN-ENDPOINT')
>>> df = wr.opensearch.search_by_sql(
>>>         client=client,
>>>         sql_query='SELECT * FROM my-index LIMIT 50'
>>>      )