Documentation
Elasticsearch

Elasticsearch

The driver for Elasticsearch is community-supported and is not supported by Cube or the vendor.

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.

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 VariableDescriptionPossible ValuesRequired
CUBEJS_DB_URLThe URL for a databaseA valid database URL for Elasticsearch
CUBEJS_DB_ELASTIC_QUERY_FORMATBy 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_OPENDISTROIf true, then use the Open Distro for Elasticsearchtrue, false
CUBEJS_DB_ELASTIC_APIKEY_IDID of the API key from elastic.co (opens in a new tab)A valid Elastic.co API key ID
CUBEJS_DB_ELASTIC_APIKEY_KEYValue of the API key from elastic.co (opens in a new tab)A valid Elastic.co API key value
CUBEJS_CONCURRENCYThe number of concurrent connections each queue has to the database. Default is 2A valid number
CUBEJS_DB_MAX_POOLThe maximum number of concurrent database connections to pool. Default is 8A valid number

SSL

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