Connector clients
editConnector clients
editThis page contains high-level instructions about setting up connector clients in your project’s UI. Because prerequisites and configuration details vary by data source, you’ll need to refer to the individual connector documentation for specific details.
A connector is a type of Elastic integration that syncs data from an original data source to Elasticsearch. Each connector extracts the original files, records, or objects; and transforms them into documents within Elasticsearch.
Connector clients are self-managed connectors that you run on your own infrastructure.
These connectors are written in Python and the source code is available in the elastic/connectors
repo.
Available connectors
editConnector clients are available for the following third-party data sources:
Click to expand
Overview
editBecause connector clients are self-managed on your own infrastructure, they run outside of your Elasticsearch Serverless project.
You can run them from source or in a Docker container.
Workflow
In order to set up, configure, and run a connector you’ll be moving between your third-party service, the Elasticsearch Serverless Serverless UI, and your terminal. At a high-level, the workflow looks like this:
- Satisfy any data source prerequisites (e.g., create an OAuth application).
- Create a connector in the UI.
- Deploy the connector service from source or with Docker.
- Enter data source configuration details in the UI.
Data source prerequisites
editThe first decision you need to make before deploying a connector is which third party service (data source) you want to sync to Elasticsearch. See the list of available connectors.
Note that each data source will have specific prerequisites you’ll need to meet to authorize the connector to access its data. For example, certain data sources may require you to create an OAuth application, or create a service account. You’ll need to check the individual connector documentation for these details.
Step 1: Initial setup in UI
editIn your project’s UI, go to Elasticsearch → Connectors. Follow these steps:
- Select Create a connector.
- Choose a third-party service from the list of connector types.
- Add a name and optional description to identify the connector.
-
Copy the
connector_id
,service_type
, andelasticsearch.host
values printed to the screen. You’ll need to update these values in yourconfig.yml
file. - Navigate to Elasticsearch → Home, and make a note of your Elasticsearch endpoint and API key values. You can create a new API key by clicking on New in the API key section.
- Run the connector code either from source or with Docker, following the instructions below.
Step 2: Deploy your self-managed connector
editTo use connector clients, you must deploy the connector service so your connector can talk to your Elasticsearch instance.
The source code is hosted in the elastic/connectors
repository.
You have two deployment options:
You’ll need the following values handy to update your config.yml
file:
-
elasticsearch.host
: Your Elasticsearch endpoint. Printed to the screen when you create a new connector. -
elasticsearch.api_key
: Your Elasticsearch API key. You can create API keys by navigating to Home, and clicking New in the API key section. Once your connector is running, you’ll be able to create a new API key that is limited to only access the connector’s index. -
connector_id
: Unique id for your connector. Printed to the screen when you create a new connector. -
service_type
: Original data source type. Printed to the screen when you create a new connector.
Run with Docker
editYou can deploy connector clients using Docker. Follow these instructions.
Step 1: Download sample configuration file
You can either download the configuration file manually or run the following command:
curl https://raw.githubusercontent.com/elastic/connectors/main/config.yml.example --output </absolute/path/to>/connectors-config/config.yml
Change the --output
argument value to the path where you want to save the configuration file.
Step 2: Update the configuration file for your self-managed connector
- Update the following settings to match your environment:
-
elasticsearch.host
-
elasticsearch.api_key
-
connector id
-
service_type
Your configuration file should look like this:
elasticsearch.host: <ELASTICSEARCH_ENDPOINT> elasticsearch.api_key: <ELASTICSEARCH_API_KEY> connectors: - connector_id: <CONNECTOR_ID_FROM_UI> service_type: <SERVICE-NAME> # sharepoint_online (example) api_key: <CONNECTOR_API_KEY> # Optional. If not provided, the connector will use the elasticsearch.api_key instead
Step 3: Run the Docker image
Use the following command, substituting values where necessary:
docker run \ -v "</absolute/path/to>/connectors-config:/config" \ # NOTE: change absolute path to match where config.yml is located on your machine --tty \ --rm \ docker.elastic.co/enterprise-search/elastic-connectors:{version}.0 \ /app/bin/elastic-ingest \ -c /config/config.yml # Path to your configuration file in the container
Find all available Docker images in the official Elastic Docker registry.
Each individual connector client reference contain instructions for deploying specific connectors using Docker.
Run from source
editRunning from source requires cloning the repository and running the code locally. Use this approach if you’re actively customizing connectors.
Follow these steps:
-
Clone or fork the repository locally with the following command:
git clone https://github.com/elastic/connectors
-
Open the
config.yml.example
file in theconnectors
repository and rename it toconfig.yml
. - Update the following settings to match your environment:
-
elasticsearch.host
-
elasticsearch.api_key
-
connector id
-
service_type
Your configuration file should look like this:
elasticsearch.host: <ELASTICSEARCH_ENDPOINT> elasticsearch.api_key: <ELASTICSEARCH_API_KEY> connectors: - connector_id: <CONNECTOR_ID_FROM_UI> service_type: <SERVICE-NAME> # sharepoint_online (example) api_key: <CONNECTOR_API_KEY> # Optional. If not provided, the connector will use the elasticsearch.api_key instead
Learn more about the config.yml
file in the repo docs.
Run the connector service
Once you’ve configured the connector code, you can run the connector service.
In your terminal or IDE:
-
cd
into the root of yourelastic/connectors
clone/fork. -
Run the following commands to compile and run the connector service:
make install make run
The connector service should now be running in your terminal. If the connection to your Elasticsearch instance was successful, the Configure your connector step will be activated in the project’s UI.
Here we’re working locally. In a production setup, you’ll deploy the connector service to your own infrastructure.
Step 3: Enter data source details in UI
editOnce the connector service is running, it’s time to head back to the UI to finalize the connector configuration. You should now see the Configure your connector step in your project’s UI.
In this step, you need to add the specific connection details about your data source instance, like URL, authorization credentials, etc. These details will vary based on the third-party data source you’re connecting to.
For example, the Sharepoint Online connector requires the following details about your Sharepoint instance:
- Tenant ID
- Tenant name
- Client ID
- Secret value
- Comma-separated list of tables
Step 4: Connect to an index
editOnce you’ve entered the data source details, you need to connect to an index. This is the final step in your project’s UI, before you can run a sync.
You can choose to sync to an existing Elasticsearch index, or create a new index for your connector. You can also create an API key that is limited to only access your selected index.
Index name prefix
Due to a bug, you must prefix your index name with search-
, otherwise you will hit an error.
For example, search-my-index
is a valid index name, but my-index
is not.
When choosing an existing index for the connector to sync to, please ensure mappings are defined and are appropriate for incoming data. Connectors will not successfully sync to existing indices without mappings. If you are unsure about managing index mappings, choose to have your connector create the new index.
Once this step is completed, you’re ready to run a sync. When a sync is launched you’ll start to see documents being added to your Elasticsearch index.
Learn how syncing works in the elastic/connectors
repo docs.
Learn more
edit- Read the main Elastic connectors documentation
-
The Elastic connector framework enables you to:
- Customize existing connector clients.
- Build your own connector clients.