Skip to content
GitHub (opens in a new tab)

Databases · MCP integration

Bring Elasticsearch into your AI workflow, on your terms.

Connect Elasticsearch through its own database connector. Give your AI access to the indices, documents and cluster diagnostics its task needs, using an identity you control. Separate recognized read APIs from requests that require your review, including writes, SQL and ES|QL.

Elasticsearch, in your AI workflow

Illustrative example

Connection in GateRook

stage-elasticsearch

Elasticsearch

stage / QA
Connector type
Elasticsearch
Name / environment
stage-elasticsearch / stage
Server URL
https://elastic.stage.example.test:9200
Authentication
API key

The route

Your AI requests a tool. GateRook checks the endpoint policy, resolves credentials locally, and calls the configured service.

Understand the request flow

Ask your AI

Count the pending orders in our stage Elasticsearch cluster. Use orders-stage and keep the request read-only.

elasticsearch_query · arguments
{
  "connection": "stage-elasticsearch",
  "method": "POST",
  "path": "/orders-stage/_count",
  "body": {
    "query": {
      "term": {
        "status": "pending"
      }
    }
  }
}
Example result
{
  "status": 200,
  "contentType": "application/json",
  "body": {
    "count": 7,
    "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
    }
  },
  "truncated": false
}

Sample configuration and output, not a live connection. Replace example values with your environment. Tool names here are connector names; the endpoint may expose a connection-specific name.

Put context to work

What you can do with Elasticsearch and AI

Explore documents and mappings together

List the available indices, inspect field mappings and ask the AI to build a Query DSL request appropriate to the stored data.

Investigate search and indexing issues

Compare counts and aggregations, inspect index settings and review recognized cluster diagnostics using the same scoped connection.

Approve an exact API operation

Review a proposed document write, bulk operation or settings change through elasticsearch_request. The approval contains the prepared request rather than a general grant to the assistant.

From service to MCP

How to connect Elasticsearch

GateRook must be running on a computer that can reach your service. Open Connections, choose Add connection, and select Elasticsearch. Give the connection a name and environment.

New to GateRook? Start with the full setup guide.
  1. Prepare a scoped Elasticsearch identity

    Create a user or API key with only the index and cluster privileges your workflow needs. For investigation, start with read permissions rather than an administrative identity.

  2. Add an Elasticsearch connection

    Open Connections, choose Add connection, then Elasticsearch under Databases. Set its name, environment and server origin.

  3. Add authentication and certificate trust

    Choose the authentication mode. For an API key, enter its already encoded value without the ApiKey prefix. Enter other secrets in GateRook's protected fields and supply a private CA when required.

  4. Test and choose the initial tool scope

    Run Test connection and inspect its cluster and index-discovery checks. It does not test writes. Enable the index and query tools for initial investigation; leave the request tool Off until you need a reviewed operation.

  5. Choose the endpoint and tool modes

    Add the tested connection to an endpoint. In Tools & policies, enable only the tools needed for the task. Start with Read only where supported; use Approval for any selected mutation and leave other tools Off. A connection alone does not grant an AI client access.

  6. Connect your AI and verify the first call

    In Clients, choose your AI app and endpoint, review the connection details, and connect. Try this guide’s example in Playground before asking your AI. Open Activity to inspect the tool, target, decision and returned result. The getting started guide covers this shared flow.

Connection settings

Configure Elasticsearch in GateRook

These are example values for the connection form. Enter credentials into GateRook’s secret fields, not into an AI prompt. Requirements and alternatives are noted per field.

Elasticsearch connection configuration
SettingExampleHow to use it
Connector typeElasticsearchChoose Elasticsearch under Databases in Add connection. It is separate from the OpenSearch connector.
Name / environmentstage-elasticsearch / stageUse a dedicated connection and server identity for the environment you want your AI to inspect.
Server URLhttps://elastic.stage.example.test:9200Enter the Elasticsearch server origin and port, without a Kibana path, API path, credentials or query string.
AuthenticationAPI keySupported modes are Username and password, API key, Bearer token and No authentication. AWS request signing belongs to the OpenSearch connector.
API keyYour encoded Elasticsearch API keyPaste the encoded value returned when the key was created, or Base64 of id:api_key. Do not add the ApiKey prefix. Store it in GateRook's protected field.
Server permissionsRead access to orders-stageSet index and cluster privileges on the server identity. The connector's REST requests use those permissions; there is no separate local index allowlist.
CA certificate (PEM)Your private CA certificate, if neededSupply a PEM CA certificate for a privately issued server certificate. GateRook still verifies the server hostname.

Know what you expose

Elasticsearch tools and access boundaries

The connector determines what is possible. Endpoint modes and connection policies determine what a particular AI client may use.

Available tools and access behavior
ToolPurposeAccess behavior
elasticsearch_indicesResolve indices, aliases and data streams accessible to the server identity, optionally using an index expression.Read only by default
elasticsearch_queryUse recognized REST read APIs for JSON Query DSL, aggregations, multi-search, documents, mappings, settings and cluster diagnostics.Read only by default
elasticsearch_requestSubmit the exact method, path, parameters and JSON or NDJSON body for writes, bulk operations, administration, SQL, ES|QL and other APIs outside the recognized read set.Approval by default, including GET

Before you enable access

  • Elasticsearch credentials determine which indices and APIs are accessible, including targets supplied in a request body. Full REST access does not grant permissions the server identity lacks.
  • elasticsearch_query refuses routes outside its recognized read set. SQL, ES|QL, reindexing, delete-by-query and other unverified APIs belong in elasticsearch_request.
  • The request tool defaults to Approval even for GET. Explicit endpoint Bypass removes the approval prompt; keep Approval or Off when you require review.
  • Requests use the configured server only. Absolute URLs, fragments and path traversal are rejected, and the REST transport does not follow redirects or automatically retry.
  • Request size, response size and execution deadlines are bounded. A truncated response or an unknown outcome after a connection failure requires inspection before another request.

GateRook stores local connection secrets encrypted and resolves them for connectors. Allowed tool results are returned to your AI client and may be processed by its provider. Scope the data you expose as well as the actions you allow.

Practical answers

Elasticsearch connection questions

Use Test connection to isolate service access problems. Use Playground and Activity to inspect endpoint permissions and tool calls.

Is this the same connector as OpenSearch?

No. Elasticsearch has its own connection type, authentication options and elasticsearch_indices, elasticsearch_query and elasticsearch_request tools. Choose the connector that matches your server.

How do I enter an Elasticsearch API key?

Use the encoded value returned when creating the key, or Base64 of id:api_key, without an ApiKey prefix. GateRook attaches the authorization header; the AI does not need the key in its prompt or tool arguments.

Can I query with SQL or ES|QL?

Use elasticsearch_request for those APIs. They are outside the recognized read set and require approval by default, even for a GET request. Server support and permissions still apply.

Can the AI modify documents or cluster settings?

Yes, when you enable the request tool and the server identity has the required privileges. Approval is the default mode. Keep that tool Off, or remove the relevant server permissions, when changes must be unavailable.

What does Test connection verify?

It checks cluster information and attempts index discovery. It does not execute writes or certify access to every API. Check the server's permissions and the result of the specific tool call in Activity.

Keep exploring

OpenSearch

Connect OpenSearch to AI through GateRook. Query documents, mappings and aggregations with local credentials, and review administrative REST requests before they run.

MongoDB

Connect MongoDB to AI through MCP with a step-by-step Docker tutorial. Query documents, approve updates, and trace every call in GateRook Activity.

HTTP API

Connect a REST or HTTP API to AI through MCP. Scope base URLs and paths, keep API keys in GateRook, and approve requests that change data.

Browse all integration guides

Your infrastructure, on your terms

Bring Elasticsearch into the conversation.

Start with one connection. Choose what your AI can do.

Read the getting started guide

Get GateRook

Download GateRook 0.7.0 for your Mac, or get the Windows app from Microsoft Store. GateRook is in active development.

macOS

Version 0.7.0 for Apple Silicon (arm64). This download does not support Intel Macs.

Open the DMG and drag GateRook to Applications.

Windows

Available for free from Microsoft Store. Install GateRook and receive updates through the Store.

macOS release notes and checksums (opens in a new tab)