Loading

Apache Superset & Preset

You can use the elasticsearch-dbapi driver to access Elasticsearch data from Apache Supersetâ„¢ and Preset.

The elasticsearch-dbapi package, originally developed and contributed by Preset, provides a DBAPI 2.0 and SQLAlchemy dialect for Elasticsearch. It communicates with Elasticsearch through the SQL REST API.

Important

Elastic does not endorse, promote or provide support for these applications; for native Elasticsearch integration in these products, reach out to their respective vendors.

In Superset, select + Database from the database connections screen. Choose Elasticsearch from the list of supported databases, or select Other and enter a SQLAlchemy URI directly.

Enter the SQLAlchemy URI for your Elasticsearch cluster. The URI format depends on your authentication method and deployment type.

For username and password authentication:

elasticsearch+https://{username}:{password}@{host}:{port}/
		

For API key authentication:

elasticsearch+https://{host}:{port}/?api_key={API_KEY}
		

For Elastic Cloud deployments, use the Elasticsearch endpoint URL from your deployment details:

elasticsearch+https://{username}:{password}@{deployment_id}.{region}.cloud.es.io:9243/
		
Note

For a local, unencrypted cluster, replace https with http in the URI scheme (for example, elasticsearch+http://localhost:9200/).

Use the Test Connection button to confirm that Superset can reach your Elasticsearch cluster. Once connected, Elasticsearch indices appear as datasets that can be queried and visualized using SQL within Superset.

The elasticsearch-dbapi driver accepts optional parameters through the SQLAlchemy URI query string:

Parameter Description
fetch_size Maximum number of rows per query result (default: 10000)
time_zone Timezone for date/time values (default: UTC)
http_compress Enable HTTP compression (true or false)
timeout Connection timeout in seconds

For example:

elasticsearch+https://user:pass@host:9243/?fetch_size=5000&time_zone=US/Eastern
		

Refer to the elasticsearch-dbapi documentation for the full list of supported parameters.

The elasticsearch-dbapi driver has some known limitations:

  • Array-type columns are not supported
  • Nested and object field types are returned as strings
  • Geo-point field types are returned as strings
  • Indices starting with . are filtered out by default

Apache, Apache Superset, Superset, and the Superset logo are trademarks of the Apache Software Foundation.