> ## Documentation Index
> Fetch the complete documentation index at: https://docs.odigos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Elasticsearch

> Configuring the Elasticsearch backend (Self-Hosted)

### Getting Started

<img src="https://d15jtxgb40qetw.cloudfront.net/elasticsearch.svg" alt="elasticsearch" className="not-prose h-20" />

{/*
  !! Do not remove this comment, this acts as a key indicator in `docs/sync-dest-doc.py` !!
  !! END CUSTOM EDIT !!
*/}

### Configuring Destination Fields

<Accordion title="Supported Signals:">
  ✅ Traces
  ❌ Metrics
  ✅ Logs
  ❌ Profiles
</Accordion>

* **ELASTICSEARCH\_URL** `string` : Elasticsearch URL. Elasticsearch endpoint. Port defaults to `9200` if not specified
  * This field is required
  * Example: `http://host:port`
* **ES\_TRACES\_INDEX** `string` : Traces Index. The name of the index where traces will be stored
  * This field is optional and defaults to `trace_index`
* **ES\_LOGS\_INDEX** `string` : Logs Index. The name of the index where logs will be stored.
  * This field is optional and defaults to `log_index`
* **ELASTICSEARCH\_BASIC\_AUTH\_ENABLED** `boolean` : Enable HTTP Basic Authentication.
  * This field is optional and defaults to `False`
* **ELASTICSEARCH\_USERNAME** `string` : Username. Username used for HTTP Basic Authentication
  * This field is optional
* **ELASTICSEARCH\_PASSWORD** `string` : Password. Password used for HTTP Basic Authentication
  * This field is optional
* **ELASTICSEARCH\_TLS\_ENABLED** `boolean` : Enable TLS. Secure connection (Transport Layer Security)
  * This field is optional and defaults to `False`
* **ELASTICSEARCH\_CA\_PEM** `string` : CA Certificate. When using TLS, provide the CA certificate to verify the server. If empty uses system root CA
  * This field is optional
  * Example: `-----BEGIN CERTIFICATE-----`

### Adding Destination to Odigos

There are two primary methods for configuring destinations in Odigos:

##### **Using the UI**

<Steps>
  <Step>
    Use the [Odigos CLI](https://docs.odigos.io/cli/odigos_ui) to access the UI

    ```bash theme={null}
    odigos ui
    ```
  </Step>

  <Step>
    Click on `Add Destination`, select `Elasticsearch` and follow the on-screen instructions
  </Step>
</Steps>

##### **Using Kubernetes manifests**

<Steps>
  <Step>
    Save the YAML below to a file (e.g. `elasticsearch.yaml`)

    ```yaml theme={null}
    apiVersion: odigos.io/v1alpha1
    kind: Destination
    metadata:
      name: elasticsearch-example
      namespace: odigos-system
    spec:
      data:
        ELASTICSEARCH_URL: <Elasticsearch URL>
        # Note: The commented fields below are optional.
        # ES_TRACES_INDEX: <Traces Index (default: trace_index)>
        # ES_LOGS_INDEX: <Logs Index (default: log_index)>
        # ELASTICSEARCH_BASIC_AUTH_ENABLED: <Enable HTTP Basic Authentication>
        # ELASTICSEARCH_USERNAME: <Username>
        # ELASTICSEARCH_TLS_ENABLED: <Enable TLS>
        # ELASTICSEARCH_CA_PEM: <CA Certificate>
      destinationName: elasticsearch
      # Uncomment the 'secretRef' below if you are using the optional Secret.
      # secretRef:
      #   name: elasticsearch-secret
      signals:
      - TRACES
      - LOGS
      type: elasticsearch

    ---

    # The following Secret is optional. Uncomment the entire block if you need to use it.
    # apiVersion: v1
    # data:
    #   ELASTICSEARCH_PASSWORD: <Base64 Password>
    # kind: Secret
    # metadata:
    #   name: elasticsearch-secret
    #   namespace: odigos-system
    # type: Opaque
    ```
  </Step>

  <Step>
    Apply the YAML using `kubectl`

    ```bash theme={null}
    kubectl apply -f elasticsearch.yaml
    ```
  </Step>
</Steps>
