elasticsearch-authn▌
elastic/agent-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Authenticate to an Elasticsearch cluster using any supported authentication realm that is already configured. This skill
- ›covers all built-in realms, credential verification, and the full API key lifecycle.
Elasticsearch Authentication
Authenticate to an Elasticsearch cluster using any supported authentication realm that is already configured. This skill covers all built-in realms, credential verification, and the full API key lifecycle.
For roles, users, role assignment, and role mappings, see the elasticsearch-authz skill.
For detailed API endpoints, see references/api-reference.md.
Deployment note: Not all realms are available on every deployment type. See Deployment Compatibility for self-managed vs. ECH vs. Serverless details.
Critical principles
- Never ask for credentials in chat. Do not ask the user to paste passwords, API keys, tokens, or any secret into the conversation. Secrets must not appear in conversation history.
- Always use environment variables. All code examples in this skill reference environment variables (e.g.
ELASTICSEARCH_PASSWORD,ELASTICSEARCH_API_KEY). When a required variable is missing, instruct the user to set it in a.envfile in the project root — never prompt for the value directly. - Prefer
.envover terminal exports. Agents may run commands in a sandboxed shell session that does not inherit the user's terminal environment. A.envfile in the working directory is reliable across all execution contexts. Only suggestexportas a fallback when the user explicitly prefers it.
Jobs to Be Done
- Authenticate to a cluster using username and password (native realm)
- Connect using an API key (bearer token)
- Verify who is currently authenticated (
_authenticate) - Choose the right authentication realm for a deployment
- Create an API key with scoped privileges for automation or service access
- Rotate or invalidate an existing API key
- Set up service account tokens for Elastic stack components
- Authenticate with PKI / mutual TLS certificate-based authentication after PKI/TLS setup
- Authenticate with configured external identity providers (SAML, OIDC, LDAP, AD, Kerberos)
- Grant API keys on behalf of other users
Prerequisites
| Item | Description |
|---|---|
| Elasticsearch URL | Cluster endpoint (e.g. https://localhost:9200 or a Cloud deployment URL) |
| Credentials | Depends on the realm — see the methods below |
| Realms configured | Authentication realms and their identity backends must already be configured (realm chain, IdP, LDAP/AD, Kerberos, PKI/TLS) |
If any required value is missing, instruct the user to add it to a .env file in the project root. Terminal exports may
not be visible to agents running in a separate shell session — the .env file is the reliable default. Never ask the
user to paste credentials into the chat — secrets must not appear in conversation history.
Authentication Realms
Elasticsearch evaluates realms in a configured order (the realm chain). The first realm that can authenticate the request wins. Internal realms are managed by Elasticsearch; external realms delegate to enterprise identity systems.
Internal realms
Native (username and password)
Users stored in a dedicated Elasticsearch index. Simplest method for interactive use. Managed via Kibana or the user management APIs (see the elasticsearch-authz skill).
curl -u "${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"
File
Users defined in flat files on each cluster node (elasticsearch-users CLI). Always active regardless of license state,
making it the fallback for disaster recovery when paid realms are disabled. Only available on self-managed deployments.
curl -u "${FILE_USER}:${FILE_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"
External realms
LDAP
Authenticates against an external LDAP directory using username and password. Self-managed only — not available on ECH or Serverless. Typically combined with role mappings to translate LDAP groups to Elasticsearch roles.
curl -u "${LDAP_USER}:${LDAP_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"
The request is identical to native — Elasticsearch routes it to the LDAP realm via the realm chain.
Active Directory
Authenticates against an Active Directory domain. Self-managed only — not available on ECH or Serverless. Similar to
LDAP but uses AD-specific defaults (user principal name, sAMAccountName). Typically combined with role mappings for AD
group-to-role translation.
curl -u "${AD_USER}:${AD_PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"
PKI (TLS client certificates)
Authenticates using X.509 client certificates presented during the TLS handshake. Requires a PKI realm and TLS on the HTTP layer. On ECH, PKI support is limited — check deployment settings. Not available on Serverless. Best for service-to-service communication in mutual TLS environments.
curl --cert "${CLIENT_CERT}" --key "${CLIENT_KEY}" --cacert "${CA_CERT}" \
"${ELASTICSEARCH_URL}/_security/_authenticate"
SAML
Enables SAML 2.0 Web Browser SSO, primarily for Kibana authentication. On self-managed, configure in
elasticsearch.yml. On ECH, configure through the Cloud deployment settings UI. On Serverless, SAML is handled at the
organization level and not configurable per project. Not usable by standard REST clients — the browser-based redirect
flow is handled by Kibana. Configure another realm (e.g. native or API keys) alongside SAML for programmatic API access.
OIDC (OpenID Connect)
Enables OpenID Connect SSO, primarily for Kibana authentication. On self-managed, configure in elasticsearch.yml. On
ECH, configure through the Cloud deployment settings UI. Not available on Serverless. Like SAML, it relies on browser
redirects and is not suited for direct REST client use. For programmatic access alongside OIDC, use API keys or native
users.
Custom applications can exchange OIDC tokens for Elasticsearch access tokens via POST /_security/oidc/authenticate,
but this requires implementing the full OIDC redirect flow.
JWT (JSON Web Tokens)
Accepts JWTs issued by an external identity provider as bearer tokens. On self-managed, configure in
elasticsearch.yml. On ECH, configure through the Cloud deployment settings UI. Not available on Serverless. Supports
two token types:
id_token(default) — OpenID Connect ID tokens for user-on-behalf-of flows.access_token— OAuth2 client credentials for application identity flows.
curl -H "Authorization: Bearer ${JWT_TOKEN}" "${ELASTICSEARCH_URL}/_security/_authenticate"
Each JWT realm handles one token type. Configure separate realms for id_token and access_token if both are needed.
Kerberos
Authenticates using Kerberos tickets via the SPNEGO mechanism. Self-managed only — not available on ECH or Serverless. Requires a working KDC infrastructure, proper DNS, and time synchronization.
kinit "${KERBEROS_PRINCIPAL}"
curl --negotiate -u : "${ELASTICSEARCH_URL}/_security/_authenticate"
The --negotiate flag enables SPNEGO. The -u : is required by curl but the username is ignored — the principal from
kinit is used. Requires curl 7.49+ with GSS-API/SPNEGO support.
API keys
Not a realm, but a distinct authentication mechanism. Pass a Base64-encoded API key in the Authorization header.
Preferred for programmatic and automated access.
curl -H "Authorization: ApiKey ${ELASTICSEARCH_API_KEY}" "${ELASTICSEARCH_URL}/_security/_authenticate"
ELASTICSEARCH_API_KEY is the encoded value (Base64 of id:api_key) returned when the key was created.
Verify authentication
Always verify credentials before proceeding:
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"
Check username, roles, and authentication_realm.type to confirm identity and method:
authentication_realm.type |
Realm |
|---|---|
native |
Native |
file |
File |
ldap |
LDAP |
active_directory |
Active Directory |
pki |
PKI |
saml |
SAML |
oidc |
OpenID Connect |
jwt |
JWT |
kerberos |
Kerberos |
For API keys, authentication_type is "api_key" (not a realm type).
Manage API Keys
Create an API key
curl -X POST "${ELASTICSEARCH_URL}/_security/api_key" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"name": "'"${KEY_NAME}"'",
"expiration": "30d",
"role_descriptors": {
"'"${ROLE_NAME}"'": {
"cluster": [],
"indices": [
{
"names": ["'"${INDEX_PATTERN}"'"],
"privileges": ["read"]
}
]
}
}
}'
The response contains id, api_key, and encoded. Store encoded securely — it cannot be retrieved again.
Omit role_descriptors to inherit a snapshot of the authenticated user's current privileges.
Limitation: An API key cannot create another API key with privileges. The derived key is created with no effective access. Use
POST /_security/api_key/grantwith user credentials instead.
Get and invalidate API keys
curl "${ELASTICSEARCH_URL}/_security/api_key?name=${KEY_NAME}" <auth_flags>
curl -X DELETE "${ELASTICSEARCH_URL}/_security/api_key" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{"name": "'"${KEY_NAME}"'"}'
Examples
Create a scoped API key
Request: "Create an API key that can only read from metrics-*."
POST /_security/api_key
{
"name": "metrics-reader-key",
"expiration": "90d",
"role_descriptors": {
"metrics-reader": {
"indices": [
{
"names": ["metrics-*"],
"privileges": ["read", "view_index_metadata"]
}
]
}
}
}
Verify which realm authenticated the user
GET /_security/_authenticate
{
"username": "joe",
"authentication_realm": { "name": "ldap1", "type": "ldap" },
"authentication_type": "realm"
}
Authenticate with a JWT bearer token
curl -H "Authorization: Bearer ${JWT_TOKEN}" "https://my-cluster:9200/_security/_authenticate"
Confirm the response shows authentication_realm.type as "jwt".
Guidelines
Choosing an authentication method
| Method | Best for | Trade-offs |
|---|---|---|
| Native user | Interactive use, simple setups | Password must be stored or prompted |
| File user | Disaster recovery, bootstrap | Must be configured on every node |
| API key | Programmatic access, CI/CD, scoped access | Cannot be retrieved after creation |
| LDAP / AD | Enterprise directory integration | Requires network access to directory server |
| PKI certificate | Service-to-service, mutual TLS environments | Requires PKI infrastructure and PKI realm |
| SAML | Kibana SSO via enterprise IdP | Browser-only; not for REST clients |
| OIDC | Kibana SSO via OpenID Connect provider | Browser-only; not for REST clients |
| JWT | Token-based service and user authentication | Requires external token issuer and realm config |
| Kerberos | Windows/enterprise Kerberos environments | Requires KDC, DNS, time sync infrastructure |
Prefer API keys for automated workflows — they support fine-grained scoping and independent expiration. For Kibana SSO, use SAML or OIDC. For enterprise directory integration, use LDAP or AD with role mappings (see elasticsearch-au
How to use elasticsearch-authn on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add elasticsearch-authn
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches elasticsearch-authn from GitHub repository elastic/agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate elasticsearch-authn. Access the skill through slash commands (e.g., /elasticsearch-authn) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★62 reviews- ★★★★★Chaitanya Patil· Dec 28, 2024
Registry listing for elasticsearch-authn matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Kabir Sethi· Dec 24, 2024
elasticsearch-authn is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Amelia Farah· Dec 20, 2024
Solid pick for teams standardizing on skills: elasticsearch-authn is focused, and the summary matches what you get after install.
- ★★★★★Ira Ghosh· Dec 20, 2024
Keeps context tight: elasticsearch-authn is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Ira Gill· Dec 20, 2024
elasticsearch-authn reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Jin Taylor· Dec 8, 2024
We added elasticsearch-authn from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Kabir Desai· Nov 27, 2024
Useful defaults in elasticsearch-authn — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Jin Liu· Nov 23, 2024
elasticsearch-authn fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Piyush G· Nov 19, 2024
elasticsearch-authn reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Sofia Brown· Nov 11, 2024
elasticsearch-authn has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 62