Elasticsearch
Elastic integration, supported by Cube, is also available in Cube Cloud on the Enterprise Premier (opens in a new tab) product tier. Contact us (opens in a new tab) for details.
Prerequisites
To connect to an Elasticsearch (opens in a new tab) database, use CUBEJS_DB_URL
with the username and password embedded in the URL, if required.
If you're not using Elastic Cloud (opens in a new tab), you must specify
CUBEJS_DB_ELASTIC_QUERY_FORMAT
.
Setup
Manual
For a self-hosted Elasticsearch instance, add the following to a .env
file in
your Cube project:
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 (opens in a new tab), add the
following to a .env
file in your Cube project:
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 Variable | Description | Possible Values | Required |
---|---|---|---|
CUBEJS_DB_URL | The URL for a database | A valid database URL for Elasticsearch | ✅ |
CUBEJS_DB_ELASTIC_QUERY_FORMAT | 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 | ❌ |
CUBEJS_DB_ELASTIC_OPENDISTRO | If true , then use the Open Distro for Elasticsearch | true , false | ❌ |
CUBEJS_DB_ELASTIC_APIKEY_ID | ID of the API key from elastic.co (opens in a new tab) | A valid Elastic.co API key ID | ❌ |
CUBEJS_DB_ELASTIC_APIKEY_KEY | Value of the API key from elastic.co (opens in a new tab) | A valid Elastic.co API key value | ❌ |
CUBEJS_CONCURRENCY | The number of concurrent connections each queue has to the database. Default is 2 | A valid number | ❌ |
CUBEJS_DB_MAX_POOL | The maximum number of concurrent database connections to pool. Default is 8 | A valid number | ❌ |
SSL
Cube does not require any additional configuration to enable SSL as Elasticsearch connections are made over HTTPS.