Connector clients

edit

Connector clients

edit

Connector clients are Elastic connectors that you self-manage on your own infrastructure. This means they run outside of your Elastic deployment.

You can run them from source or from a Docker container. Deploying your self-managed connector details the options.

For a concrete end-to-end example, see PostgreSQL connector client tutorial.

The following connectors are available as connector clients:

Availability and Elastic prerequisites

edit

Connector clients currently don’t support Windows. Use this compatability matrix to check which operating systems are supported by connector clients. Find this information under Connector Clients on that page.

Expand to see the Elastic prerequisites

Your Elastic deployment must include the following Elastic services:

  • Elasticsearch
  • Kibana

(A new Elastic Cloud deployment includes these services by default.)

To run connector clients your self-deployed connector service version must match your Elasticsearch version. For example, if you’re running Elasticsearch 8.10.1, your connector service should be version 8.10.1.x. Elastic does not support deployments running mismatched versions (except during upgrades).

As of 8.10.0 connectors no longer require the Enterprise Search service. However, if you are upgrading connectors from versions earlier than 8.9, you’ll need to run Enterprise Search once to migrate your connectors to the new format.

You must have access to Kibana and have write indices privileges for the .elastic-connectors index.

You must additionally deploy the connector service. See Deploying your self-managed connector.

Support and licensing

Depending on how you use connector clients, support and licensing requirements will vary.

Refer to the following subscriptions pages for details. Find your connector of interest in the Elastic Search section under Client Integrations:

Note the following information regarding support for connector clients:

  • A converted but unmodified native connector is supported by Elastic.
  • A converted but customized native connector is not supported by Elastic.

In order to setup, configure, and run a connector you’ll be moving between your third-party service, the Kibana UI, and your terminal.

Initial setup in Kibana

edit

Follow the Connector workflow in the Kibana UI to select the Connector ingestion method.

Next, complete these steps:

  1. Choose which third-party service you’d like to use by selecting a data source.
  2. Create and name a new Elasticsearch index.
  3. Generate a new API key and save it somewhere safe.
  4. Name your connector and provide an optional description
  5. Convert native connector to a connector client (Only applicable if connector is also available natively). This action is irreversible.
  6. Copy the configuration block from the example shown on the screen. You’ll use this in a later step:

    # ...
    connectors:
      - connector_id: <CONNECTOR-ID>
        api_key: <API-KEY> # Scoped API key for this connector (optional). If not specified, the top-level `elasticsearch.api_key` value is used.
        service_type: gmail # example

Deploying your self-managed connector

edit

To use connector clients, you must deploy the connector service. The source code is hosted in the elastic/connectors repository.

You have two deployment options:

Option 1: Run from source

edit

This is a good option if you’re comfortable working with Python and want to iterate quickly locally.

Clone the repository and edit config.yml
edit

Once you’ve created an index, and entered the access details for your data source, you’re ready to deploy the connector service.

First, you need to clone the elastic/connectors repository.

Follow these steps:

  • Clone or fork the connectors repository locally with the following command: git clone https://github.com/elastic/connectors.
  • Open the config.yml configuration file in your editor of choice.
  • Replace the values for host (your Elasticsearch endpoint), api_key, connector_id, and service_type.

    Expand to see an example config.yml file

    Replace the values for api_key, connector_id, and service_type with the values you copied earlier.

    elasticsearch:
      api_key: <key1> # Used to write data to .elastic-connectors and .elastic-connectors-sync-jobs
                    # Any connectors without a specific `api_key` value will default to using this key
    connectors:
      - connector_id: 1234
        api_key: <key2> # Used to write data to the `search-*` index associated with connector 1234
                        # You may have multiple connectors in your config file!
      - connector_id: 5678
        api_key: <key3> # Used to write data to the `search-*` index associated with connector 5678
      - connector_id: abcd # No explicit api key specified, so this connector will use <key1>

    API keys for connectors

    You can configure multiple connectors in your config.yml file.

    The Kibana UI enables you to create API keys that are scoped to a specific index/connector. If you don’t create an API key for a specific connector, the top-level elasticsearch.api_key or elasticsearch.username:elasticsearch.password value is used.

    If these top-level Elasticsearch credentials are not sufficiently privileged to write to individual connector indices, you’ll need to create these additional, scoped API keys.

    Use the example above as a guide.

Run the connector service
edit

You need Python version 3.10 or higher to run the connectors service from source.

Once you’ve configured the connector code, you can run the connector service.

In your terminal or IDE:

  1. cd into the root of your connectors clone/fork.
  2. Run the following commands to compile and run the connector service:

    make install
    make run

The connector service should now be running. The UI will let you know that the connector has successfully connected to your Elasticsearch instance.

Here we’re working locally. In a production setup, you’ll deploy the connector service to your own infrastructure.

Option 2: Run with Docker

edit

You can also deploy connector clients using Docker. This is a good option if you don’t want to worry about your local Python environment.

To do this you will:

  • Create a Docker network.
  • Create a directory to be mounted into the Docker image.
  • Download the sample configuration file (conf.yml) into that directory.
  • Update the config file with your specific values:

    • host (your Elasticsearch endpoint)
    • api_key
    • connector_id
    • service_type.
  • Run the Docker image with the Connector Service

Each connector client reference in these docs contains specific instructions for deploying your connector using Docker.

Enter data source details in Kibana

edit

Once the connector service is running, it’s time to head back to the Kibana UI to finalize the connector configuration. In this step, you need to add the specific connection details about your data source instance, like URL, authorization credentials, etc. As mentioned above, these details will vary based on the third-party data source you’re connecting to.

For example, the PostgreSQL connector requires the following details:

  • Host
  • Port
  • Username
  • Password
  • Database
  • Comma-separated list of tables

You’re now ready to run a sync. Select the Full sync button in the Kibana UI to start ingesting documents into Elasticsearch.

Tutorial

edit

Our PostgreSQL connector client tutorial is a concrete example of running a self-managed connector service and a connector client. This example uses the PostgreSQL connector but the basic process is the same for all connector clients.

Connector testing

edit

The connector framework enables you to run end-to-end (E2E) tests on your connector clients, against a real data source.

To avoid tampering with a real Elasticsearch instance, E2E tests run an isolated Elasticsearch instance in Docker. Configuration values are set in your docker-compose.yml file. Docker Compose manages the setup of the development environment, including both the mock Elastic instance and mock data source.

E2E tests use default configuration values for the connector. Find instructions about testing in each connector’s documentation.

Connector framework

edit

The Elastic connector framework enables you to:

  • Customize existing connector clients.
  • Build your own connector clients.

Refer to Elastic connector framework for more information.