> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/add-an-elasticsearch-connector.md).

# Add an ElasticSearch connector

Add an ElasticSearch connector so Harness can use ElasticSearch as a verification provider.

Elasticsearch is a distributed search and analytics engine, commonly deployed as part of the ELK stack, that stores and searches large volumes of log and event data. Add an Elasticsearch connector in Harness to let your pipelines query your Elasticsearch logs. Harness can then use that data in Continuous Verification to compare log patterns and detect anomalies after a deployment, helping you confirm a release is healthy or trigger a rollback.

Go to [Overview](https://developer.harness.io/harness-platform/use-harness-platform/connectors/monitoring-and-logging-systems/monitoring-and-logging-systems-connectors-overview.md) for information about all monitoring and logging connectors, such as scopes and delegate selection.

***

## What you will learn from this topic

* How to [add an ElasticSearch connector](#add-an-elasticsearch-connector) to a Harness project.
* How to configure the [URL and authentication method](#credentials) that Harness uses to connect to ElasticSearch.

***

## Before you begin

* **ElasticSearch access**: The URL of your ElasticSearch server, and credentials for the authentication method you plan to use.
* **Harness permissions**: Permission to create connectors and secrets in Harness.

***

## Add an ElasticSearch connector

You can add an ElasticSearch connector at the project, org, or account scope. This procedure covers the project scope, and the process is the same for org and account.

1. Open your Harness project.
2. In **Project Settings**, select **Connectors**.
3. Click **New Connector**, then select **ElasticSearch** under **Monitoring and Logging Systems**. The ElasticSearch connector settings appear.

### Overview

Configure the identity fields for the connector:

1. In **Name**, enter a name for the connector. Harness generates the **Id** from the name.
2. Optionally, add a **Description** and **Tags**.
3. Click **Continue**.

![ElasticSearch connector overview settings](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-7ed942b97bf3d790529e7f1f0057722727c5804d%2Felasticsearch-connector-overview.png?alt=media)

### Credentials

Configure the following settings:

1. In **URL**, enter the URL of your ElasticSearch server.
2. In **Authentication**, select one of the following options:

* **Username and Password**:
  * For **Username**, enter your ElasticSearch account username.
  * For **Password**, select or create a [Harness encrypted text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md).
* **API Key**:
  * **API ID**: Enter the public identifier for your Elasticsearch cluster.
  * **API Key**: Enter the corresponding API key string to authenticate the connection.
* **Bearer Token(HTTP Header)**: Authenticate with a bearer token sent in the HTTP header.
* **No Authentication**: Connect without credentials. Use this option only when your ElasticSearch server does not require authentication.

3. Click **Continue**.

![ElasticSearch connector credentials with the Username and Password authentication option](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-e089b2013be6da0d52ce011fce452590271d900a%2Felasticsearch-connector-credentials.png?alt=media)

### Delegates Setup

Select one of the following options:

* **Use any available Delegate**: Harness selects an available delegate at runtime.
* **Only use Delegates with all of the following tags**: Enter the tags of the delegates Harness must use with this connector.

Click **Save and Continue**.

![ElasticSearch connector delegates setup with the delegate connectivity list](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-5e07c7e949eb2aac3b2f4f014db3a82612d9f55f%2Felasticsearch-connector-delegates-setup.png?alt=media)

### Verify Connection

Click **Finish** after the connection test succeeds. The connector is listed in **Connectors** page.

***

## Sample YAML

The following example shows a YAML for the ElasticSearch connector created in this topic.

<details>

<summary>YAML - ElasticSearch connector</summary>

```yaml
connector:
  name: your-elasticsearch-connector # Replace with a name for your connector
  identifier: yourelasticsearchconnector # Replace with a unique identifier
  description: ""
  accountIdentifier: youraccountidentifier # Replace with your Harness account identifier
  orgIdentifier: default # Replace with your organization identifier, or remove for account scope
  projectIdentifier: yourprojectidentifier # Replace with your project identifier, or remove for org/account scope
  type: ElasticSearch
  spec:
    url: your-elasticsearch-url # Replace with the URL of your ElasticSearch server
    username: your-elasticsearch-username # Replace with your ElasticSearch username
    passwordRef: your-password-secret # Replace with a reference to the Harness secret storing your password
    authType: UsernamePassword # Authentication type for Username and Password
    ignoreTestConnection: false # Set to true only to skip connector preflight checks
```

</details>

For the full connector YAML schema, including how to skip connector preflight checks, go to [Create a connector using YAML](https://developer.harness.io/harness-platform/use-harness-platform/connectors/create-a-connector-using-yaml.md).

***

## Next steps

* [Use delegate selectors](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/manage-delegates/select-delegates-with-selectors.md): Control which delegates can connect to this connector.
* [Add a text secret](https://developer.harness.io/harness-platform/use-harness-platform/secrets/add-use-text-secrets.md): Store ElasticSearch credentials as Harness secrets.
