elasticsearch-security-troubleshooting
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseElasticsearch Security Troubleshooting
Elasticsearch 安全故障排查
Diagnose and resolve common Elasticsearch security issues. This skill provides a structured triage workflow for
authentication failures, authorization errors, TLS problems, API key issues, role mapping mismatches, Kibana login
failures, and license-expiry lockouts.
For authentication methods and API key management, see the elasticsearch-authn skill. For roles, users, and role
mappings, see the elasticsearch-authz skill. For license management, see the elasticsearch-license skill.
For diagnostic API endpoints, see references/api-reference.md.
Deployment note: Diagnostic API availability differs between self-managed, ECH, and Serverless. See Deployment Compatibility for details.
诊断并解决常见的Elasticsearch安全问题。本技能提供了一套结构化的分流排查流程,涵盖认证失败、授权错误、TLS问题、API密钥问题、角色映射不匹配、Kibana登录失败以及许可证过期锁定等场景。
关于认证方法和API密钥管理,请参考elasticsearch-authn技能。关于角色、用户和角色映射,请参考elasticsearch-authz技能。关于许可证管理,请参考elasticsearch-license技能。
关于诊断API端点,请查看references/api-reference.md。
部署说明: 诊断API的可用性在自托管、ECH和Serverless部署之间存在差异。详情请见 部署兼容性。
Jobs to Be Done
需完成的任务
- Diagnose HTTP 401 authentication failures
- Diagnose HTTP 403 permission denied errors
- Troubleshoot TLS/SSL handshake or certificate errors
- Investigate expired or invalid API keys
- Debug role mappings that do not grant expected roles
- Fix Kibana login failures, redirect loops, or CORS errors
- Recover from a license-expiry lockout
- Determine why a user lacks access to a specific index
- 诊断HTTP 401认证失败问题
- 诊断HTTP 403权限拒绝错误
- 排查TLS/SSL握手或证书错误
- 调查过期或无效的API密钥
- 调试未授予预期角色的角色映射
- 修复Kibana登录失败、重定向循环或CORS错误
- 从许可证过期锁定状态恢复
- 确定用户无法访问特定索引的原因
Prerequisites
前提条件
| Item | Description |
|---|---|
| Elasticsearch URL | Cluster endpoint (e.g. |
| Authentication | Any valid credentials — even minimal — to reach the cluster |
| Cluster privileges | |
Prompt the user for any missing values. If the user cannot authenticate at all, start with
TLS and Certificate Errors or License Expiry Recovery.
Diagnostic Workflow
诊断流程
Route the symptom to the correct section:
| Symptom | Section |
|---|---|
HTTP 401, | Authentication Failures |
HTTP 403, | Authorization Failures |
| SSL/TLS handshake error, certificate rejected | TLS and Certificate Errors |
| API key rejected, expired, or ineffective | API Key Issues |
| Role mapping not granting expected roles | Role Mapping Issues |
| Kibana login broken, redirect loop, CORS error | Kibana Authentication Issues |
| All users locked out, paid features disabled | License Expiry Recovery |
Each section follows a Gather - Diagnose - Resolve pattern.
Diagnostic Toolkit
诊断工具集
Use these APIs at the start of any security investigation:
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"Confirms identity, realm, and roles. If this fails with 401, the problem is authentication.
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_xpack"Confirms whether security is enabled (). If security is disabled, all security APIs return
errors.
features.security.enabledbash
curl -X POST "${ELASTICSEARCH_URL}/_security/user/_has_privileges" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"index": [
{ "names": ["'"${INDEX_PATTERN}"'"], "privileges": ["read"] }
]
}'Tests whether the authenticated user holds specific privileges without requiring .
manage_securitybash
curl <auth_flags> "${ELASTICSEARCH_URL}/_license"Check license type and status. An expired paid license disables paid realms and features.
在任何安全问题排查开始时,都可以使用以下API:
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"确认身份、域和角色。如果请求返回401,则问题出在认证环节。
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_xpack"确认安全功能是否已启用()。如果安全功能已禁用,所有安全API都会返回错误。
features.security.enabledbash
curl -X POST "${ELASTICSEARCH_URL}/_security/user/_has_privileges" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"index": [
{ "names": ["'"${INDEX_PATTERN}"'"], "privileges": ["read"] }
]
}'测试已认证用户是否拥有特定权限,无需权限。
manage_securitybash
curl <auth_flags> "${ELASTICSEARCH_URL}/_license"检查许可证类型和状态。过期的付费许可证会禁用付费域和功能。
Authentication Failures (401)
认证失败(401)
A 401 response means Elasticsearch could not verify the caller's identity.
401响应意味着Elasticsearch无法验证调用者的身份。
Gather
收集信息
bash
curl -v <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate" 2>&1The flag shows headers and the response body. Look for:
-v- header — indicates which auth schemes the cluster accepts.
WWW-Authenticate - in the response body — the
authentication_exceptionfield describes what failed.reason
bash
curl -v <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate" 2>&1-v- 请求头——指示集群接受的认证方案。
WWW-Authenticate - 响应体中的——
authentication_exception字段描述了失败原因。reason
Diagnose
诊断
| Symptom | Likely cause |
|---|---|
| Wrong username or password |
| Credentials do not match any realm in the chain |
| The native user account is disabled |
| API key or bearer token has expired |
No | Security may be disabled; check |
If the user authenticates via an external realm (LDAP, AD, SAML, OIDC), the realm chain order matters. Elasticsearch
tries realms in configured order and stops at the first match. If a higher-priority realm rejects the credentials before
the intended realm is reached, authentication fails.
| 症状 | 可能原因 |
|---|---|
| 用户名或密码错误 |
| 凭据与认证链中的任何域都不匹配 |
| 本地用户账户已被禁用 |
| API密钥或Bearer令牌已过期 |
无 | 安全功能可能已禁用;请检查 |
如果用户通过外部域(LDAP、AD、SAML、OIDC)认证,域链的顺序很重要。Elasticsearch会按照配置的顺序尝试域,找到第一个匹配的域后就会停止。如果优先级较高的域在预期域之前拒绝了凭据,认证就会失败。
Resolve
解决方法
| Cause | Action |
|---|---|
| Wrong credentials | Verify username/password or API key value. See elasticsearch-authn. |
| Disabled user | |
| Expired API key | Create a new API key. See API Key Issues. |
| Realm chain order | Check |
| Security disabled | Enable |
| Paid realm after expiry | License expired — see License Expiry Recovery. |
Authorization Failures (403)
授权失败(403)
A 403 response means the user is authenticated but lacks the required privileges.
403响应意味着用户已通过认证,但缺少所需的权限。
Gather
收集信息
Test the specific privileges the operation requires:
bash
curl -X POST "${ELASTICSEARCH_URL}/_security/user/_has_privileges" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"index": [
{ "names": ["logs-*"], "privileges": ["read", "view_index_metadata"] }
],
"cluster": ["monitor"]
}'The response contains a boolean and per-resource breakdowns.
has_all_requestedAlso check the user's effective roles:
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"Inspect the array and to confirm the user is who you expect.
rolesauthentication_realm测试操作所需的特定权限:
bash
curl -X POST "${ELASTICSEARCH_URL}/_security/user/_has_privileges" \
<auth_flags> \
-H "Content-Type: application/json" \
-d '{
"index": [
{ "names": ["logs-*"], "privileges": ["read", "view_index_metadata"] }
],
"cluster": ["monitor"]
}'响应包含一个布尔值和按资源细分的权限检查结果。
has_all_requested同时检查用户的有效角色:
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"查看数组和,确认用户身份符合预期。
rolesauthentication_realmDiagnose
诊断
| Symptom | Likely cause |
|---|---|
| Role is missing the required index privilege |
| Role is missing the required cluster privilege |
| User has fewer roles than expected | Roles array was replaced (not merged) on last update |
| API key returns 403 on previously allowed | API key privileges are a snapshot — role changes after |
| operation | creation do not propagate to existing keys |
| 症状 | 可能原因 |
|---|---|
针对索引的 | 角色缺少所需的索引权限 |
针对集群的 | 角色缺少所需的集群权限 |
| 用户拥有的角色少于预期 | 上次更新时角色数组被替换(而非合并) |
| API密钥在之前允许的操作上返回403 | API密钥的权限是快照式的——创建密钥后角色的变更不会同步到现有密钥 |
Resolve
解决方法
| Cause | Action |
|---|---|
| Missing index privilege | Add the privilege to the role or create a new role. See elasticsearch-authz. |
| Missing cluster privilege | Add the cluster privilege. See elasticsearch-authz. |
| Roles replaced on update | Fetch current roles first, then update with the full array. See elasticsearch-authz. |
| Stale API key privileges | Create a new API key with updated |
| 原因 | 操作 |
|---|---|
| 缺少索引权限 | 为角色添加所需权限或创建新角色。请参考elasticsearch-authz。 |
| 缺少集群权限 | 为角色添加集群权限。请参考elasticsearch-authz。 |
| 更新时角色被替换 | 先获取当前角色,然后使用完整数组进行更新。请参考elasticsearch-authz。 |
| API密钥权限过时 | 使用更新后的 |
TLS and Certificate Errors
TLS和证书错误
TLS errors prevent the client from establishing a connection at all.
TLS错误会阻止客户端建立连接。
Gather
收集信息
bash
curl -v --cacert "${CA_CERT}" "https://${ELASTICSEARCH_HOST}:9200/" 2>&1 | head -30Look for:
- — CA not trusted.
SSL certificate problem: unable to get local issuer certificate - — certificate past its validity date.
SSL certificate problem: certificate has expired - — hostname mismatch.
SSL: no alternative certificate subject name matches target host name
For deeper inspection (self-managed only):
bash
openssl s_client -connect "${ELASTICSEARCH_HOST}:9200" -showcerts </dev/null 2>&1This displays the full certificate chain, expiry dates, and subject alternative names.
bash
curl -v --cacert "${CA_CERT}" "https://${ELASTICSEARCH_HOST}:9200/" 2>&1 | head -30重点关注:
- ——CA证书不被信任。
SSL certificate problem: unable to get local issuer certificate - ——证书已过有效期。
SSL certificate problem: certificate has expired - ——主机名不匹配。
SSL: no alternative certificate subject name matches target host name
如需更深入的检查(仅适用于自托管部署):
bash
openssl s_client -connect "${ELASTICSEARCH_HOST}:9200" -showcerts </dev/null 2>&1该命令会显示完整的证书链、过期日期和主题备用名称。
Diagnose
诊断
| Error message | Likely cause |
|---|---|
| Missing or wrong CA certificate |
| Server or CA certificate past expiry |
| Certificate SAN does not include the hostname |
| Self-signed cert not in the trust store |
| Truststore missing the CA or wrong password |
| 错误信息 | 可能原因 |
|---|---|
| 缺少或使用了错误的CA证书 |
| 服务器或CA证书已过期 |
| 证书的SAN不包含目标主机名 |
| 自签名证书不在信任存储中 |
| 信任存储中缺少CA证书或密码错误 |
Resolve
解决方法
| Cause | Action |
|---|---|
| Wrong CA cert | Pass the correct CA with |
| Expired certificate | Regenerate certificates with |
| Hostname mismatch | Regenerate the certificate with the correct SAN entries. |
| Self-signed cert | Distribute the CA cert to all clients or use a publicly trusted CA. |
| Quick workaround | Use |
On ECH, TLS is managed by Elastic — certificate errors usually indicate the client is not using the correct Cloud
endpoint URL. On Serverless, TLS is fully managed and transparent.
| 原因 | 操作 |
|---|---|
| CA证书错误 | 使用 |
| 证书过期 | 使用 |
| 主机名不匹配 | 重新生成包含正确SAN条目的证书。 |
| 自签名证书 | 将CA证书分发给所有客户端,或使用公共可信CA。 |
| 临时解决方法 | 使用 |
在ECH部署中,TLS由Elastic管理——证书错误通常表示客户端使用了错误的云端点URL。在Serverless部署中,TLS完全由Elastic管理,对用户透明。
API Key Issues
API密钥问题
Gather
收集信息
Retrieve the key's metadata:
bash
curl "${ELASTICSEARCH_URL}/_security/api_key?name=${KEY_NAME}" <auth_flags>Check , , and in the response.
expirationinvalidatedrole_descriptors获取密钥的元数据:
bash
curl "${ELASTICSEARCH_URL}/_security/api_key?name=${KEY_NAME}" <auth_flags>检查响应中的、和字段。
expirationinvalidatedrole_descriptorsDiagnose
诊断
| Symptom | Likely cause |
|---|---|
| 401 when using the key | Key expired or invalidated |
| 403 on operations that should be allowed | Key was created with insufficient |
| Derived key has no access | API key created another API key — derived keys have no privilege |
| Key works for some indices but not others | |
| 症状 | 可能原因 |
|---|---|
| 使用密钥时返回401 | 密钥已过期或被吊销 |
| 本应允许的操作返回403 | 创建密钥时 |
| 派生密钥无访问权限 | API密钥创建了另一个API密钥——派生密钥没有任何权限 |
| 密钥对部分索引有效但对其他索引无效 | |
Resolve
解决方法
| Cause | Action |
|---|---|
| Expired key | Create a new key with appropriate |
| Invalidated key | Create a new key. Invalidated keys cannot be reinstated. |
| Wrong scope | Create a new key with correct |
| Derived key problem | Use |
| 原因 | 操作 |
|---|---|
| 密钥过期 | 创建带有合适 |
| 密钥被吊销 | 创建新密钥。被吊销的密钥无法恢复。 |
| 作用域错误 | 使用正确的 |
| 派生密钥问题 | 使用用户凭据执行 |
Role Mapping Issues
角色映射问题
Role mappings grant roles to users from external realms. When they fail silently, users authenticate but get no roles.
角色映射用于为来自外部域的用户授予角色。当映射静默失败时,用户可以通过认证,但无法获得任何角色。
Gather
收集信息
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"Note the , , and array.
usernameauthentication_realm.namerolesbash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/role_mapping"List all mappings and inspect their and fields.
rulesenabledbash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"记录、和数组。
usernameauthentication_realm.namerolesbash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/role_mapping"列出所有映射并检查它们的和字段。
rulesenabledDiagnose
诊断
| Symptom | Likely cause |
|---|---|
User has empty | No mapping matches the user's attributes |
| User gets wrong roles | A different mapping matched first or the rule is too broad |
| Mapping exists but does not apply | |
| Mustache template produces wrong role name | Template syntax error or unexpected attribute value |
Compare the user's and (from ) against each mapping's to
find the mismatch.
authentication_realm.namegroups_authenticaterules| 症状 | 可能原因 |
|---|---|
用户的 | 没有映射匹配用户的属性 |
| 用户获得错误的角色 | 其他映射先匹配成功,或规则范围太广 |
| 映射存在但不生效 | |
| Mustache模板生成错误的角色名称 | 模板语法错误或属性值不符合预期 |
将用户的和(来自响应)与每个映射的进行比较,找出不匹配的地方。
authentication_realm.namegroups_authenticaterulesResolve
解决方法
| Cause | Action |
|---|---|
| No matching rule | Update the mapping rules to match the user's realm and attributes. |
| Mapping disabled | Set |
| Template error | Test the Mustache template with known attribute values. See elasticsearch-authz. |
| Rule too broad | Add |
| 原因 | 操作 |
|---|---|
| 无匹配规则 | 更新映射规则以匹配用户的域和属性。 |
| 映射被禁用 | 将映射的 |
| 模板错误 | 使用已知的属性值测试Mustache模板。请参考elasticsearch-authz。 |
| 规则范围太广 | 添加 |
Kibana Authentication Issues
Kibana认证问题
Missing kbn-xsrf
header
kbn-xsrf缺少kbn-xsrf
请求头
kbn-xsrfAll mutating Kibana API requests require the header:
kbn-xsrfbash
curl -X PUT "${KIBANA_URL}/api/security/role/my-role" \
<auth_flags> \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{ ... }'Without it, Kibana returns with .
400 Bad Request"Request must contain a kbn-xsrf header"所有修改类的Kibana API请求都需要请求头:
kbn-xsrfbash
curl -X PUT "${KIBANA_URL}/api/security/role/my-role" \
<auth_flags> \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{ ... }'如果缺少该请求头,Kibana会返回,并提示。
400 Bad Request"Request must contain a kbn-xsrf header"SAML/OIDC redirect loop
SAML/OIDC重定向循环
Common causes:
- Incorrect or
xpack.security.authc.realms.saml.*.sp.acsinidp.metadata.path.elasticsearch.yml - Clock skew between the IdP and Elasticsearch nodes (SAML assertions have a validity window).
- Kibana does not match the SAML ACS URL.
server.publicBaseUrl
Verify the SAML realm configuration:
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"If this returns a valid user via a non-SAML realm, the SAML realm itself is not being reached. Check realm chain order.
常见原因:
- 中的
elasticsearch.yml或xpack.security.authc.realms.saml.*.sp.acs配置错误。idp.metadata.path - IdP与Elasticsearch节点之间的时钟不同步(SAML断言有有效期窗口)。
- Kibana的与SAML ACS URL不匹配。
server.publicBaseUrl
验证SAML域配置:
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_security/_authenticate"如果请求通过非SAML域返回有效用户,则说明SAML域本身未被访问到。请检查域链顺序。
Kibana cannot reach Elasticsearch
Kibana无法连接到Elasticsearch
Kibana logs . Verify the setting
in points to a reachable endpoint and the credentials ( /
or ) are valid.
Unable to retrieve version information from Elasticsearch nodeselasticsearch.hostskibana.ymlelasticsearch.usernameelasticsearch.passwordelasticsearch.serviceAccountTokenKibana日志中显示。请验证中的设置指向可访问的端点,且凭据(/或)有效。
Unable to retrieve version information from Elasticsearch nodeskibana.ymlelasticsearch.hostselasticsearch.usernameelasticsearch.passwordelasticsearch.serviceAccountTokenLicense Expiry Recovery
许可证过期恢复
When a paid license expires, the cluster enters a security-closed state: paid realms (SAML, LDAP, AD, PKI) stop
working and users authenticating through them are locked out. Native and file realms remain functional.
当付费许可证过期时,集群会进入安全关闭状态:付费域(SAML、LDAP、AD、PKI)停止工作,通过这些域认证的用户会被锁定。本地域和文件域仍然可用。
Quick triage
快速排查
bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_license"If is , proceed with recovery.
license.status"expired"bash
curl <auth_flags> "${ELASTICSEARCH_URL}/_license"如果为,则按照恢复步骤操作。
license.status"expired"Recovery steps
恢复步骤
Follow the detailed recovery workflow in the elasticsearch-license skill. The critical first step depends on
deployment type:
| Deployment | First step |
|---|---|
| Self-managed | Log in with a file-based user ( |
| ECH | Contact Elastic support or renew via the Cloud console. |
| Serverless | Not applicable — licensing is fully managed by Elastic. |
请遵循elasticsearch-license技能中的详细恢复流程。关键的第一步取决于部署类型:
| 部署类型 | 第一步 |
|---|---|
| 自托管 | 使用文件用户( |
| ECH | 联系Elastic支持或通过云控制台续订许可证。 |
| Serverless | 不适用——许可证完全由Elastic管理。 |
Examples
示例
User gets 403 when querying logs
用户查询日志时返回403
Symptom: "I get a 403 when searching ."
logs-*- Verify identity:
bash
curl -u "joe:${PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"Response shows .
"roles": ["viewer"]- Test privileges:
bash
curl -X POST "${ELASTICSEARCH_URL}/_security/user/_has_privileges" \
-u "joe:${PASSWORD}" \
-H "Content-Type: application/json" \
-d '{"index": [{"names": ["logs-*"], "privileges": ["read"]}]}'Response: — the role does not include on .
"has_all_requested": falseviewerreadlogs-*- Fix: create a role and assign it to Joe. See elasticsearch-authz.
logs-reader
症状: "我搜索时收到403错误。"
logs-*- 验证身份:
bash
curl -u "joe:${PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"响应显示。
"roles": ["viewer"]- 测试权限:
bash
curl -X POST "${ELASTICSEARCH_URL}/_security/user/_has_privileges" \
-u "joe:${PASSWORD}" \
-H "Content-Type: application/json" \
-d '{"index": [{"names": ["logs-*"], "privileges": ["read"]}]}'响应:——角色不包含对的权限。
"has_all_requested": falseviewerlogs-*read- 解决方法:创建角色并将其分配给Joe。请参考elasticsearch-authz。
logs-reader
API key stopped working
API密钥突然失效
Symptom: "My API key returns 401 since yesterday."
- Check the key:
bash
curl -u "admin:${PASSWORD}" "${ELASTICSEARCH_URL}/_security/api_key?name=my-key"Response shows — the key expired.
"expiration": 1709251200000- Fix: create a new API key with a suitable . See elasticsearch-authn.
expiration
症状: "我的API密钥从昨天开始返回401错误。"
- 检查密钥:
bash
curl -u "admin:${PASSWORD}" "${ELASTICSEARCH_URL}/_security/api_key?name=my-key"响应显示——密钥已过期。
"expiration": 1709251200000- 解决方法:创建带有合适的新API密钥。请参考elasticsearch-authn。
expiration
SAML login redirects to error
SAML登录重定向到错误页面
Symptom: "Clicking the SSO button in Kibana redirects to an error page."
- Check if the SAML realm is reachable by authenticating with a non-SAML method:
bash
curl -u "elastic:${PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"- Verify the IdP metadata URL is accessible from the Elasticsearch nodes (self-managed):
bash
curl -s "${IDP_METADATA_URL}" | head -5- Check for clock skew — SAML assertions are time-sensitive. Ensure NTP is configured on all nodes.
- Verify in
server.publicBaseUrlmatches the SAML ACS URL configured in the IdP.kibana.yml
症状: "点击Kibana中的SSO按钮后重定向到错误页面。"
- 通过非SAML方法认证,检查SAML域是否可访问:
bash
curl -u "elastic:${PASSWORD}" "${ELASTICSEARCH_URL}/_security/_authenticate"- 验证IdP元数据URL是否可从Elasticsearch节点访问(自托管部署):
bash
curl -s "${IDP_METADATA_URL}" | head -5- 检查时钟同步——SAML断言对时间敏感。确保所有节点都配置了NTP。
- 验证中的
kibana.yml与IdP中配置的SAML ACS URL是否匹配。server.publicBaseUrl
Users locked out after license expired
许可证过期后所有用户被锁定
Symptom: "Nobody can log in to Kibana. We use SAML."
- Check license:
bash
curl -u "admin:${PASSWORD}" "${ELASTICSEARCH_URL}/_license"Response shows , .
"status": "expired""type": "platinum"- The SAML realm is disabled because the paid license expired. Follow the recovery steps in elasticsearch-license: log in with a file-based or native user, then upload a renewed license or revert to basic.
症状: "没有人能登录到Kibana。我们使用SAML认证。"
- 检查许可证:
bash
curl -u "admin:${PASSWORD}" "${ELASTICSEARCH_URL}/_license"响应显示, 。
"status": "expired""type": "platinum"- 由于付费许可证过期,SAML域已被禁用。请遵循elasticsearch-license中的恢复步骤:使用文件用户或本地用户登录,然后上传续订的许可证或降级到基础许可证。
Guidelines
指导原则
Always start with _authenticate
_authenticate始终从_authenticate
开始
_authenticateRun as the first diagnostic step. It reveals the user's identity, realm, roles, and
authentication type in a single call. Most issues become apparent from this response alone.
GET /_security/_authenticate将作为第一个诊断步骤。它可以在一次调用中揭示用户的身份、域、角色和认证类型。大多数问题从这个响应中就能显现出来。
GET /_security/_authenticateCheck the license early
尽早检查许可证
Before investigating realm or privilege issues, verify the license is active with . An expired paid
license disables realms and features, producing symptoms that mimic misconfiguration.
GET /_license在排查域或权限问题之前,先使用验证许可证是否有效。过期的付费许可证会禁用域和功能,产生的症状与配置错误类似。
GET /_licenseUse _has_privileges
before manual inspection
_has_privileges先使用_has_privileges
再手动检查
_has_privilegesInstead of reading role definitions and mentally computing effective access, use
to test specific privileges directly. This is faster and accounts for role composition, DLS, and FLS.
POST /_security/user/_has_privileges不要通过阅读角色定义来手动计算有效权限,而是使用直接测试特定权限。这种方法更快,而且能考虑到角色组合、DLS和FLS的影响。
POST /_security/user/_has_privilegesAvoid superuser credentials
避免使用超级用户凭据
Never use the built-in superuser for day-to-day troubleshooting. Create a dedicated admin user or API key with
privileges. Reserve the user for initial setup and emergency recovery only.
elasticmanage_securityelastic日常排查时绝不要使用内置的超级用户。创建一个专用的管理员用户或带有权限的API密钥。仅在初始设置和紧急恢复时使用用户。
elasticmanage_securityelasticDo not bypass TLS in production
生产环境中不要绕过TLS
Using or skips certificate verification and masks real TLS issues. Use it only for initial
diagnosis, then fix the underlying certificate problem.
curl -k--insecure使用或会跳过证书验证,掩盖真实的TLS问题。仅在初始诊断时使用,然后修复底层的证书问题。
curl -k--insecureDeployment Compatibility
部署兼容性
Diagnostic tool and API availability differs across deployment types.
| Tool / API | Self-managed | ECH | Serverless |
|---|---|---|---|
| Yes | Yes | Yes |
| Yes | Yes | Yes |
| Yes | Yes | Limited |
| Yes | Yes (read) | Not available |
| Yes | Yes | Yes |
| Yes | Yes | Yes |
| Yes | Not available | Not available |
| Yes | Not available | Not available |
| Elasticsearch logs | Yes | Via Cloud UI | Via Cloud UI |
ECH notes:
- No node-level access, so the CLI and direct log/certificate inspection are not available.
elasticsearch-users - TLS is managed by Elastic — certificate errors typically indicate an incorrect endpoint URL.
- Use the Cloud console for log inspection and deployment configuration.
Serverless notes:
- Licensing APIs are not exposed. License-related lockouts do not occur.
- Native users do not exist — authentication issues are handled at the organization level.
- TLS is fully managed and transparent.
诊断工具和API的可用性因部署类型而异。
| 工具/API | 自托管 | ECH | Serverless |
|---|---|---|---|
| 是 | 是 | 是 |
| 是 | 是 | 是 |
| 是 | 是 | 受限 |
| 是 | 是(只读) | 不可用 |
| 是 | 是 | 是 |
| 是 | 是 | 是 |
| 是 | 不可用 | 不可用 |
节点上的 | 是 | 不可用 | 不可用 |
| Elasticsearch日志 | 是 | 通过云UI查看 | 通过云UI查看 |
ECH说明:
- 无节点级访问权限,因此无法使用CLI和直接查看日志/证书。
elasticsearch-users - TLS由Elastic管理——证书错误通常表示使用了错误的端点URL。
- 使用云控制台查看日志和配置部署。
Serverless说明:
- 不暴露许可证API。不会发生与许可证相关的锁定。
- 不存在本地用户——认证问题在组织级别处理。
- TLS完全由Elastic管理,对用户透明。