Not able to connect elastic search to cube.js

For the use case we need to connect the existing mysql connection along with elastic search in a multi data source application.

CUBEJS_DB_URL=" the url of the index"
CUBEJS_DB_ELASTIC_APIKEY_ID= "not sure what to put here"
CUBEJS_DB_ELASTIC_APIKEY_KEY= "not sure what to put here"

when i create a connection with th eabove details the below error comes up , so i am not sure how we can connect the elastic search in a multi data source connection with an existing mysql cubejs.
Please can any one guide regarding this process.

Error: apiSecret is required option(s)
at CubejsServerCore.handleConfiguration (/cube/node_modules/@cubejs-backend/server-core/src/core/server.ts:476:15)
at new CubejsServerCore (/cube/node_modules/@cubejs-backend/server-core/src/core/server.ts:122:25)
at Function.create (/cube/node_modules/@cubejs-backend/server-core/src/core/server.ts:539:12)
at new CubejsServer (/cube/node_modules/@cubejs-backend/server/src/server.ts:78:26)
at ServerContainer.runServerInstance (/cube/node_modules/@cubejs-backend/server/src/server/container.ts:234:20)
at makeInstance (/cube/node_modules/@cubejs-backend/server/src/server/container.ts:344:33)
at ServerContainer.start (/cube/node_modules/@cubejs-backend/server/src/server/container.ts:357:20)
at (/cube/node_modules/@cubejs-backend/server/src/command/server.ts:25:5)
at Command. (/cube/node_modules/cubejs-cli/src/command/proxy-command.ts:51:13)

Hi @Samarth_Nanda !
Could you please share the Elasticsearch “flavor” and version that you’re using?

If you use opendistro please make sure that global var CUBEJS_DB_ELASTIC_OPENDISTRO=true.

i am using version 7.14.1 of elastic search and i need that data to be shown in the cube frontend

As I can see two approaches are supported here:

auth.apiKey = {
api_key: process.env.CUBEJS_DB_ELASTIC_APIKEY_KEY
node: process.env.CUBEJS_DB_URL,

const auth = {
username: process.env.CUBEJS_DB_USER,
password: process.env.CUBEJS_DB_PASS,
you can pass obj with these params
this.config = {
url: process.env.CUBEJS_DB_URL,
ssl: this.getSslOptions(),
(process.env.CUBEJS_DB_ELASTIC_OPENDISTRO || ‘false’).toLowerCase() === ‘true’ ||
process.env.CUBEJS_DB_TYPE === ‘odelasticsearch’,
queryFormat: process.env.CUBEJS_DB_ELASTIC_QUERY_FORMAT || ‘jdbc’,
You should be able to pass your url in config so something like this should work:
if (dataSource === ‘es’) {
return new ElasticSearchDriver({
url: “your_url”, // or process.env.my_custom_var
auth: { username: “your_name”,
password: “pass”
} else {
return new PostgresDriver({
database: process.env.CUBEJS_DB_NAME,
host: process.env.CUBEJS_DB_HOST,
user: process.env.CUBEJS_DB_USER,
password: process.env.CUBEJS_DB_PASS,
port: 5432,
Feel free to create an issue on GitHub if it doesn’t work for you for some reason

I am also having the same java issue.