> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# Set up Elasticsearch in Metorial for Claude, ChatGPT and Cursor
URL: https://metorial.com/docs/integrations/elasticsearch
Last updated: 2026-11-24

Share Elasticsearch with your team in Claude, ChatGPT and Cursor through Metorial: basic authentication or bearer token sign-in, 20 tools (6 read-only).

---

To give your team Elasticsearch in Claude, ChatGPT, Cursor and other AI clients, an admin shares the Elasticsearch integration in a Metorial portal, and each person connects with a basic authentication. Index, search, and analyze documents in Elasticsearch clusters. The integration has 20 tools, 6 read-only, 13 write and 1 destructive, plus 2 triggers.

**What you will learn**

- How an admin shares Elasticsearch in a portal and how each person connects
- What Elasticsearch asks for when you connect, and where to find it
- How to keep the 6 read-only tools and reject the other 14

**Before you start**

- A [portal](https://metorial.com/docs/platform/workforce/portals) with at least one access group
- A basic authentication from Elasticsearch for each person, or one for a shared connection
- For the CLI steps: the [Metorial CLI](https://metorial.com/docs/platform/cli), signed in to your portal

## Sign-in methods

| Method | Type | What a person provides |
| --- | --- | --- |
| **Basic Authentication** (default) | Custom credentials | `elasticsearchUrl`, `username` and `password` |
| **Bearer Token** | Custom credentials | `elasticsearchUrl` and `token` |
| **API Key** | API token | `elasticsearchUrl` and `token` |

The portal and `metorial setup` use **Basic Authentication** unless someone picks another method.

### Basic Authentication

To connect, a person enters these values:

- `elasticsearchUrl`: Base URL of your Elasticsearch cluster (e.g., https://my-cluster.es.cloud:9243)
- `username`: Elasticsearch username
- `password`: Elasticsearch password

### Bearer Token

To connect, a person enters these values:

- `elasticsearchUrl`: Base URL of your Elasticsearch cluster (e.g., https://my-cluster.es.cloud:9243)
- `token`: OAuth2 access token obtained from the /_security/oauth2/token endpoint

### API Key

To connect, a person enters these values:

- `elasticsearchUrl`: Base URL of your Elasticsearch cluster (e.g., https://my-cluster.es.cloud:9243)
- `token`: Base64-encoded API key (the "encoded" value returned when the API key was created)

## Admin: share Elasticsearch in a portal

### In the dashboard

1. **Open Shared Resources**

   Open **Workforce**, choose the portal, and select **Shared Resources** under **Access**.

2. **Share a new integration**

   Select **Share a Resource**, then **New Integration**, and choose Elasticsearch. Under **Auth Method**, keep **Basic Authentication** or pick another. For how members connect, choose **Each person connects** so everyone enters their own basic authentication, or **Shared connection** to enter one basic authentication for everyone.

3. **Limit the tools**

   Under **Tool Filters**, set the write and destructive groups to **Reject** if agents should only read from Elasticsearch.

4. **Choose who gets it**

   Add the access groups that should see Elasticsearch. When a person asks for access from the portal, the request appears under **Access Requests**.

### With the CLI

The CLI cannot create the per-user Elasticsearch integration. Once it exists, check which groups have it:

```bash
metorial-admin portals access list <portal-id> --type provider_template --search elasticsearch
```

## Employee: connect Elasticsearch

### In the portal

1. **Open Elasticsearch in the catalog**

   Sign in to your portal and open Elasticsearch. The status reads **Available**.

2. **Authenticate**

   Under **Quick setup**, select **Authenticate**. In the setup window, enter your basic authentication (elasticsearchUrl, username and password).

3. **Confirm**

   The status changes to **Configured**. If it later reads **Needs reconnect**, select **Reconnect** and sign in again.

### With the CLI

```bash
metorial catalog search elasticsearch
metorial setup <catalog-item-id>
```

`catalog search` prints the catalog item ID. `metorial setup` uses **Basic Authentication**. To connect with **Bearer Token** instead, find its ID with `metorial catalog get <catalog-item-id>` and add `--auth-method <auth-method-id>`.

### Add it to your AI client

`metorial install` adds your Elasticsearch connection to a local MCP client such as Claude Code, Cursor or Codex. `metorial list` prints the integration ID and `metorial client list` the client identifiers.

```bash
metorial list elasticsearch
metorial client list
metorial install <client-identifier> <integration-id>
```

For a client that takes a server URL, such as ChatGPT, `metorial install custom <integration-id>` creates an installation token and shows the endpoint details.

## Make it read-only

Open the integration's **Tool Filters** and set the write and destructive groups to **Reject**. Agents keep the 6 read-only tools, such as `esql_query` and `get_document`, and lose the 13 write tools, such as `reindex` or `manage_alias`, and the destructive tool `delete_document`.

Employees see the result on the integration's page in the portal under **Tool access**. For the full walkthrough, see [Tool permissions](https://metorial.com/docs/platform/guides/tool-permissions).

## Check it worked

```bash
metorial list elasticsearch
metorial tools <integration-id>
metorial call <integration-id> list_indices -d '{}'
```

`metorial tools` lists the 20 tools, minus any you rejected. `list_indices` takes no input. It lists all indices in the Elasticsearch cluster with their health status, document count, and storage size.

To see every input a tool takes, run `metorial schema <integration-id> <tool-key>`.

## Tools

### Read-only tools (6)

- `cluster_health`: Get the health status and key metrics of the Elasticsearch cluster including node count, shard allocation status, and pending tasks.
- `list_indices`: List all indices in the Elasticsearch cluster with their health status, document count, and storage size.
- `get_document`: Retrieve one or more known Elasticsearch documents by ID.
- `search_documents`: Search and query documents in Elasticsearch using the full Query DSL.
- `graph_explore`: Discover relationships between terms in an Elasticsearch index. Needs `indexName` and `vertices`.
- `esql_query`: Execute an ES|QL query to filter, transform, and analyze data stored in Elasticsearch. Needs `query`.

### Write tools (13)

- `bulk_operations`: Perform multiple index, create, update, or delete operations in a single API call. Needs `operations`.
- `index_document`: Create or replace a document in an Elasticsearch index. Needs `indexName` and `document`.
- `update_document`: Partially update an existing document in an Elasticsearch index. Needs `indexName` and `documentId`.
- `manage_index`: Create, configure, open, close, or delete an Elasticsearch index. Needs `action` and `indexName`.
- `manage_watch`: Create, update, delete, execute, activate, or deactivate Watcher alerts. Needs `action` and `watchId`.
- `manage_alias`: Create, delete, or list index aliases. Needs `action`.
- `manage_snapshot`: Create, restore, delete, or retrieve snapshots and snapshot repositories for cluster backups. Needs `action`.
- `reindex`: Copy documents from one index to another, optionally applying a query filter or transformations via a script. Needs `sourceIndex` and `destinationIndex`.
- `run_inference`: Execute a machine learning inference task using a configured inference endpoint. Needs `action`.
- `manage_security`: Manage Elasticsearch security resources including users, roles, and API keys. Needs `resourceType` and `action`.
- `manage_pipeline`: Create, update, delete, list, or simulate ingest pipelines. Needs `action`.
- `manage_index_template`: Create, retrieve, list, or delete Elasticsearch composable index templates. Needs `action`.
- `manage_async_search`: Submit, retrieve, or delete an Elasticsearch asynchronous search. Needs `action`.

### Destructive tools (1)

- `delete_document`: Remove a document from an Elasticsearch index by its ID. Needs `indexName` and `documentId`.

## Triggers

Elasticsearch has 2 triggers, which fire on events in Elasticsearch:

- `watcher_alert`: Polls the Watcher execution history for new alert executions.
- `inbound_webhook`

## Next steps

- [Claude Code](https://metorial.com/docs/platform/clients/claude-code), [Cursor](https://metorial.com/docs/platform/clients/cursor), [Codex](https://metorial.com/docs/platform/clients/codex) and [ChatGPT](https://metorial.com/docs/platform/clients/chatgpt): connect each client to your portal and use Elasticsearch there
- [Tool permissions](https://metorial.com/docs/platform/guides/tool-permissions): tool filters and what employees see
- [Elasticsearch on metorial.com](https://metorial.com/integrations/elasticsearch): the integration overview