Until we support Elasticsearch API keys for the CLI tool, it can be helpful to provide a more intuitive error message.
For example, if I use -c config.yml where the config is using the API key (that's the config used for running the connector service), it throws the following error, which I assume is a way of saying the CLI tool does not support API keys yet?
$ ./connectors -c ../config.yml connector create
[FMWK][16:41:30][INFO] Loading config from ../config.yml
? Index name: test1
? Service type (azure_blob_storage, confluence, dir, dropbox, github, gmail, google_cloud_storage, google_drive, jira, mongodb, mssql, mysql, network_drive, onedrive, oracle, outlook, postgresql, s3, salesforce, servicenow, sharepoint_online, sharepoint_server, slack, microsoft_teams, zoom, box): salesforce
? Index language (leave empty for universal) ['da', 'de', 'en', 'es', 'fr', 'it', 'ja', 'ko', 'nl', 'pt', 'pt-br', 'ru', 'th', 'zh'] []:
? Domain []: elastic
? Client ID []:
? Client Secret []:
? Use text extraction service [False]:
Traceback (most recent call last):
File "/Users/<user>/Downloads/connectors-main/bin/./connectors", line 33, in <module>
sys.exit(load_entry_point('elasticsearch-connectors', 'console_scripts', 'connectors')())
File "/Users/<user>/Downloads/connectors-main/connectors/connectors_cli.py", line 590, in main
cli()
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/click/decorators.py", line 45, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/Users/<user>/Downloads/connectors-main/connectors/connectors_cli.py", line 287, in create
result = connector.create(
File "/Users/<user>/Downloads/connectors-main/connectors/cli/connector.py", line 60, in create
return asyncio.run(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/<user>/Downloads/connectors-main/connectors/cli/connector.py", line 85, in __create
raise e
File "/Users/<user>/Downloads/connectors-main/connectors/cli/connector.py", line 81, in __create
return await self.__create_connector(
File "/Users/<user>/Downloads/connectors-main/connectors/cli/connector.py", line 103, in __create_connector
api_key = await self.__create_api_key(index_name)
File "/Users/<user>/Downloads/connectors-main/connectors/cli/connector.py", line 215, in __create_api_key
return await self.es_management_client.client.security.create_api_key(
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/elasticsearch/_async/client/security.py", line 414, in create_api_key
return await self.perform_request( # type: ignore[return-value]
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/elasticsearch/_async/client/_base.py", line 389, in perform_request
return await self._client.perform_request(
File "/Users/<user>/Downloads/connectors-main/lib/python3.10/site-packages/elasticsearch/_async/client/_base.py", line 320, in perform_request
raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
elasticsearch.BadRequestError: BadRequestError(400, 'illegal_argument_exception', 'creating derived api keys requires an explicit role descriptor that is empty (has no privileges)')
Until we support Elasticsearch API keys for the CLI tool, it can be helpful to provide a more intuitive error message.
For example, if I use
-c config.yml
where the config is using the API key (that's the config used for running the connector service), it throws the following error, which I assume is a way of saying the CLI tool does not support API keys yet?