Connectors CLI is a command-line interface to Elastic Connectors for use in your terminal or scripts.
Warning: Connectors CLI is in tech preview.
Note: Connectors CLI helps with Elastic Connectors managing connectors and running sync jobs. To pick up and execute sync jobs you need to run Connector Service manually.
- Clone the repository
git clone https://github.com/elastic/connectors.git
- Run
make clean install
to install dependencies and create executable files. - Connectors CLI is available via
./bin/connectors
Note: Make sure your Elasticsearch instance is up and running.
- Run
./bin/connectors login
to authenticate the CLI with an Elasticsearch instance. - Provide credentials
- The command will create or ask to rewrite an existing configuration file in
./cli/config.yml
By default, the CLI uses basic authentication method (username, password) however an API key can be used too.
Run ./bin/connectors login --method apikey
to authenticate the CLI via your API key.
When you run any command you can specify a configuration file using -c
argument.
Example:
./bin/connectors -c <config-file-path.yml> connector list
Connectors CLI provides a --help
/-h
argument that can be used with any command to get more information.
For example:
./bin/connectors --help
Usage: connectors [OPTIONS] COMMAND [ARGS]...
Options:
-v, --version Show the version and exit.
-c, --config FILENAME
--help Show this message and exit.
Commands:
connector Connectors management
index Search indices management
job Sync jobs management
login Authenticate Connectors CLI with an Elasticsearch instance
connectors connector create
connectors connector list
connectors job list
connectors job cancel
connectors job start
connectors job view
Creates a new connector and links it to an Elasticsearch index. When executing the command you will be asked to provide a connector configuration based on the service type you selected. For instance, you will be asked for host, username, and password if you select mysql
.
To bypass interactive mode you can use the --from-file
argument, pointing to a key-value JSON file with a connectors configuration.
Examples:
./bin/connectors connector create \
--index-name my-index \
--service-type sharepoint_online \
--index-language en \
--from-file sharepoint-config.json
This will create a new SharePoint Online connector with an Elasticsearch index my-index
and configuration from sharepoint-online-config.json
.
Note See the connectors' source code to get more information about their configuration fields.
Lists all the existing connectors
Examples:
./bin/connectors connector list
This will display all existing connectors and the associated indices.
Lists all jobs and their stats.
Examples
./bin/connectors job list -- <connector_id>
This will display all sync jobs including information like job status, number of indexed documents and index data volume associated with connector_id
.
Marks the job as cancelling
to let Connector services know that the job has to be canceled.
Examples:
./bin/connectors job cancel -- <job_id>
Schedules a new sync job and lets Connector service pick it up.
Examples:
./bin/connectors job start -- \
-i <connector_id> \
-t <job_type{full,incremental,access_control}> \
-o <format{text,json}>
This will schedule a new sync job using job type and connector id. The output of the command contains a job id.
Shows information about a sync job.
Examples:
./bin/connectors job view -- <job_id> -o <format{text,json}
This will display information about the job including job id, connector id, indexed document counts and index data value.