ElasticsearchSQLHook

Elasticsearch Hook that interact with Elasticsearch through the elasticsearch-dbapi

Usage Example

tests/system/providers/elasticsearch/example_elasticsearch_query.py[source]

    es = ElasticsearchSQLHook(elasticsearch_conn_id=CONN_ID)

    # Handle ES conn with context manager
    with es.get_conn() as es_conn:
        tables = es_conn.execute('SHOW TABLES')
        for table, *_ in tables:
            print(f"table: {table}")
    return True

Was this entry helpful?