ElasticSearch Connection

The ElasticSearch connection that enables ElasticSearch integrations.

Authenticating to ElasticSearch

Authenticate with the ElasticSearch DBAPI

Default Connection IDs

Some hooks and operators related to ElasticSearch use elasticsearch_default by default.

Configuring the Connection


Specify the login used for the initial connection


Specify the Elasticsearch API key used for the initial connection


Specify the Elasticsearch host used for the initial connection


Specify the Elasticsearch port for the initial connection


Specify the schema for the Elasticsearch API. http by default

Extra (Optional)

Specify the extra parameters (as json dictionary) that can be used in Azure connection. The following parameters are all optional:

  • http_compress: specify whether or not to use http_compress. False by default.

  • timeout: specify the time frame of the timeout. False by default.

When specifying the connection in environment variable you should specify it using URI syntax.

Note that all components of the URI should be URL-encoded.

For example:

export AIRFLOW_CONN_ELASTICSEARCH_DEFAULT='elasticsearch://elasticsearchlogin:elasticsearchpassword@elastic.co:80/http'


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?