Create connector API

Create connector API

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

New API reference

For the most up-to-date API details, refer to Connector APIs.

Creates an Elastic connector. Connectors are Elasticsearch integrations that bring content from third-party data sources, which can be deployed on Elastic Cloud or hosted on your own infrastructure:

  • Managed connectors are a managed service on Elastic Cloud
  • Self-managed connectors are self-hosted on your infrastructure

Find a list of all supported service types in the connectors documentation.

To get started with Connector APIs, check out our tutorial.

  1. resp = client.connector.put(
  2. connector_id="my-connector",
  3. index_name="search-google-drive",
  4. name="My Connector",
  5. service_type="google_drive",
  6. )
  7. print(resp)
  1. response = client.connector.put(
  2. connector_id: 'my-connector',
  3. body: {
  4. index_name: 'search-google-drive',
  5. name: 'My Connector',
  6. service_type: 'google_drive'
  7. }
  8. )
  9. puts response
  1. const response = await client.connector.put({
  2. connector_id: "my-connector",
  3. index_name: "search-google-drive",
  4. name: "My Connector",
  5. service_type: "google_drive",
  6. });
  7. console.log(response);
  1. PUT _connector/my-connector
  2. {
  3. "index_name": "search-google-drive",
  4. "name": "My Connector",
  5. "service_type": "google_drive"
  6. }

Request

  • POST _connector
  • PUT _connector/<connector_id>

Prerequisites

  • To sync data using self-managed connectors, you need to deploy the Elastic connector service. on your own infrastructure. This service runs automatically on Elastic Cloud for Elastic managed connectors.
  • The service_type parameter should reference a supported third-party service. See the available service types for Elastic managed and self-managed connectors. This can also reference the service type of your custom connector.

Description

Creates a connector document in the internal index and initializes its configuration, filtering, and scheduling with default values. These values can be updated later as needed.

Path parameters

<connector_id>

(Optional, string) Unique identifier of a connector.

Request body

description

(Optional, string) The description of the connector.

index_name

(Optional, string) The target index to sync data. If the index doesn’t exist, it will be created upon the first sync.

name

(Optional, string) The name of the connector. Setting the connector name is recommended when managing connectors in Kibana.

is_native

(Optional, boolean) Indicates if it’s a managed connector. Defaults to false.

language

(Optional, string) Language analyzer for the data. Limited to supported languages.

service_type

(Optional, string) Connector service type. Can reference Elastic-supported third-party services or a custom connector type. See the available service types for Elastic managed and self-managed connectors.

Response body

id

(string) The ID associated with the connector document. Returned when using a POST request.

result

(string) The result of the indexing operation, created or updated. Returned when using a PUT request.

Response codes

200

Indicates that an existing connector was updated successfully.

201

Indicates that the connector was created successfully.

400

Indicates that the request was malformed.

Examples

  1. resp = client.connector.put(
  2. connector_id="my-connector",
  3. index_name="search-google-drive",
  4. name="My Connector",
  5. description="My Connector to sync data to Elastic index from Google Drive",
  6. service_type="google_drive",
  7. language="en",
  8. )
  9. print(resp)
  1. const response = await client.connector.put({
  2. connector_id: "my-connector",
  3. index_name: "search-google-drive",
  4. name: "My Connector",
  5. description: "My Connector to sync data to Elastic index from Google Drive",
  6. service_type: "google_drive",
  7. language: "en",
  8. });
  9. console.log(response);
  1. PUT _connector/my-connector
  2. {
  3. "index_name": "search-google-drive",
  4. "name": "My Connector",
  5. "description": "My Connector to sync data to Elastic index from Google Drive",
  6. "service_type": "google_drive",
  7. "language": "en"
  8. }

The API returns the following result:

  1. {
  2. "result": "created",
  3. "id": "my-connector"
  4. }