Back to Cube

Elasticsearch

docs/content/product/configuration/data-sources/elasticsearch.mdx

1.6.433.9 KB
Original Source

Elasticsearch

<CommunitySupportedDriver dataSource="Elasticsearch" /> <WarningBox>

Elasticsearch driver is deprecated and will be removed in a future release.

</WarningBox>

Prerequisites

To connect to an Elasticsearch database, use <EnvVar>CUBEJS_DB_URL</EnvVar> with the username and password embedded in the URL, if required.

<WarningBox>

If you're not using Elastic Cloud, you must specify <EnvVar>CUBEJS_DB_ELASTIC_QUERY_FORMAT</EnvVar>.

</WarningBox>

Setup

Manual

For a self-hosted Elasticsearch instance, add the following to a .env file in your Cube project:

dotenv
CUBEJS_DB_TYPE=elasticsearch
CUBEJS_DB_URL=https://my.elasticsearch.host:9200
CUBEJS_DB_ELASTIC_QUERY_FORMAT=json

For an Elasticsearch instanced hosted by Elastic.co, add the following to a .env file in your Cube project:

dotenv
CUBEJS_DB_TYPE=elasticsearch
CUBEJS_DB_URL=https://my.elasticsearch.host:9200
CUBEJS_DB_ELASTIC_APIKEY_ID=VuaCfGcBCdbkQm-e5aOx
CUBEJS_DB_ELASTIC_APIKEY_KEY=ui2lp2axTNmsyakw9tvNnw

Environment Variables

Environment VariableDescriptionPossible ValuesRequired
<EnvVar>CUBEJS_DB_URL</EnvVar>The URL for a databaseA valid database URL for Elasticsearch
<EnvVar>CUBEJS_DB_ELASTIC_QUERY_FORMAT</EnvVar>By default, queries return data in JDBC format, but you can also return data in standard Elasticsearch JDBC, JSON, CSV, YAML or raw formats (only JSON and JDBC are currently supported)json, jdbc
<EnvVar>CUBEJS_DB_ELASTIC_OPENDISTRO</EnvVar>If true, then use the Open Distro for Elasticsearchtrue, false
<EnvVar>CUBEJS_DB_ELASTIC_APIKEY_ID</EnvVar>ID of the API key from elastic.coA valid Elastic.co API key ID
<EnvVar>CUBEJS_DB_ELASTIC_APIKEY_KEY</EnvVar>Value of the API key from elastic.coA valid Elastic.co API key value
<EnvVar>CUBEJS_DB_MAX_POOL</EnvVar>The maximum number of concurrent database connections to pool. Default is 8A valid number
<EnvVar>CUBEJS_CONCURRENCY</EnvVar>The number of concurrent queries to the data sourceA valid number

SSL

Cube does not require any additional configuration to enable SSL as Elasticsearch connections are made over HTTPS.