ElasticsearchSQLHook

通过 elasticsearch-dbapi 与 Elasticsearch 交互的 Elasticsearch 钩子

使用示例

tests/system/elasticsearch/example_elasticsearch_query.py[源代码]

    es = ElasticsearchSQLHook(elasticsearch_conn_id=CONN_ID)

    es_connection = es.get_conn()
    response = es_connection.execute_sql("SHOW TABLES")
    for row in response["rows"]:
        print(f"row: {row}")
    return True

这个条目有帮助吗?