> For the complete documentation index, see [llms.txt](https://docs.pagerly.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagerly.io/sre-ai-agent/data-sources/elasticsearch.md).

# Elasticsearch

## What the Agent Can Do

* Search logs by keyword, time range, and field filters
* List available indices and their health
* Query using Elasticsearch DSL

## Setup Instructions

1. Get your Elasticsearch cluster URL (e.g., `https://my-cluster.es.us-east-1.aws.found.io:9243`)
2. Create an API key or use Basic auth credentials:
   * **Elastic Cloud:** Go to **Management** > **Security** > **API keys** > **Create API key**
   * **Self-hosted:** Use your existing username/password or create an API key
3. Paste your cluster URL and credentials in the Pagerly dashboard

## Required Credentials

| Field                    | Description                          | Example                                             |
| ------------------------ | ------------------------------------ | --------------------------------------------------- |
| **Elasticsearch URL**    | Cluster URL (include port if needed) | `https://my-cluster.es.us-east-1.aws.found.io:9243` |
| **API Key** *(optional)* | Encoded API key (id:key format)      | —                                                   |

## Context Prompt Tips

> *"Our logs are in the logs-* index. Use kubernetes.namespace for filtering. Error logs have level=error. Timestamps are in @timestamp field."\*

## Docs

* [Elasticsearch REST APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html)
